[llvm-commits] [hlvm] r38081 - in /hlvm/trunk: SConstruct scons/check.py scons/configure.py scons/environment.py scons/filterbuilders.py scons/main.py test/SConscript test/lib/identity.exp
Reid Spencer
reid at x10sys.com
Sat Jul 7 16:59:39 PDT 2007
Author: reid
Date: Sat Jul 7 18:59:39 2007
New Revision: 38081
URL: http://llvm.org/viewvc/llvm-project?rev=38081&view=rev
Log:
Get DejaGnu working with scons
Added:
hlvm/trunk/scons/check.py
hlvm/trunk/test/SConscript
Modified:
hlvm/trunk/SConstruct
hlvm/trunk/scons/configure.py
hlvm/trunk/scons/environment.py
hlvm/trunk/scons/filterbuilders.py
hlvm/trunk/scons/main.py
hlvm/trunk/test/lib/identity.exp
Modified: hlvm/trunk/SConstruct
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/SConstruct?rev=38081&r1=38080&r2=38081&view=diff
==============================================================================
--- hlvm/trunk/SConstruct (original)
+++ hlvm/trunk/SConstruct Sat Jul 7 18:59:39 2007
@@ -6,6 +6,6 @@
from scons import main
env = main.GetBuildEnvironment(COMMAND_LINE_TARGETS,ARGUMENTS)
Export('env')
-
-SConscript(path.join(env['BuildDir'],'hlvm','SConscript'))
-SConscript(path.join(env['BuildDir'],'tools','SConscript'))
+main.Dirs(env,['hlvm','tools','test'])
+if 'check' in COMMAND_LINE_TARGETS:
+ main.GetCheck(env)
Added: hlvm/trunk/scons/check.py
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/scons/check.py?rev=38081&view=auto
==============================================================================
--- hlvm/trunk/scons/check.py (added)
+++ hlvm/trunk/scons/check.py Sat Jul 7 18:59:39 2007
@@ -0,0 +1,61 @@
+from SCons.Environment import Environment as Environment
+from environment import ProvisionEnvironment as ProvisionEnvironment
+import re,fileinput,os,glob
+from string import join as sjoin
+from os.path import join as pjoin
+
+def getTestCases(dir,env):
+ context = pjoin(env['AbsSrcRoot'],'test',dir)
+ result = []
+ for d in glob.glob(pjoin(context,'*.*')):
+ if not os.path.isdir(d):
+ if not d == pjoin(context,'dg.exp'):
+ result.append(d)
+ return result
+
+def SiteExpAction(target,source,env):
+ tgtpath = pjoin(env['AbsObjRoot'],'test')
+ outf = open(pjoin(tgtpath,'site.exp'),"w")
+ outf.write('## these variables are automatically generated by make ##\n')
+ outf.write('# Do not edit here. If you wish to override these values\n')
+ outf.write('# edit the last section\n')
+ outf.write('set target_triplet "fubar-pc-noos"\n')
+ outf.write('set srcdir "' + env['AbsSrcRoot'] + '/test"\n')
+ outf.write('set objdir "' + env['AbsObjRoot'] + '/test"\n')
+ outf.write('set tmpdir "$objdir/tmp"\n')
+ outf.write('set srcrootdir "' + env['AbsSrcRoot'] + '"\n')
+ outf.write('set objrootdir "' + env['AbsObjRoot'] + '"\n')
+ outf.write('## All vars above are generated by scons. Do Not Edit!\n')
+ outf.close()
+ return 0
+
+def SiteExpMessage(target,source,env):
+ return "Building DejaGnu site.exp file"
+
+def CheckAction(target,source,env):
+ if env['RUNTEST'] == None:
+ print "Testing was disabled because DejaGnu 'runtest' was not found"
+ return 0
+
+ context = os.path.basename(env.File(target[0]).path)
+ context = re.sub('(.*?)\..*','\\1',context)
+ print "context=",context
+ os.system('DEJAGNU="'+pjoin(env['AbsObjRoot'],'test','site.exp')+'" '+
+ env['RUNTEST'] + ' --tool ' + context)
+ return 0
+
+def CheckMessage(target,source,env):
+ return "Running DejaGNU Test Suite"
+
+def Check(env):
+ checkAction = env.Action(CheckAction,CheckMessage)
+ checkBuilder = env.Builder(action=checkAction,suffix='results')
+ sitexpAction = env.Action(SiteExpAction,SiteExpMessage)
+ sitexpBuilder = env.Builder(action=sitexpAction,suffix='exp')
+ env.Append(BUILDERS = {'Check':checkBuilder,'SiteExp':sitexpBuilder})
+ env.SiteExp('#test/site.exp',[])
+ env.Check(['#test/xml2xml.sum','#test/xml2xml.log'],
+ getTestCases('xml2xml',env)+['#test/site.exp'])
+ env.Alias('check','#test/xml2xml.log')
+ return 1
+
Modified: hlvm/trunk/scons/configure.py
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/scons/configure.py?rev=38081&r1=38080&r2=38081&view=diff
==============================================================================
--- hlvm/trunk/scons/configure.py (original)
+++ hlvm/trunk/scons/configure.py Sat Jul 7 18:59:39 2007
@@ -149,6 +149,9 @@
def CheckForPrograms(conf,env):
if not conf.CheckProgram('gperf','GPERF'):
env.Exit(1)
+ if not conf.CheckProgram('runtest','RUNTEST'):
+ env['RUNTEST'] = None
+ print "*** TESTING DISABLED ***"
return 1
#dnl AC_PATH_PROG(path_EGREP, egrep, egrep)
Modified: hlvm/trunk/scons/environment.py
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/scons/environment.py?rev=38081&r1=38080&r2=38081&view=diff
==============================================================================
--- hlvm/trunk/scons/environment.py (original)
+++ hlvm/trunk/scons/environment.py Sat Jul 7 18:59:39 2007
@@ -27,7 +27,6 @@
PathOption('prefix','Specify where to install HLVM','/usr/local')
)
opts.Update(env)
- env['CC'] = 'g++'
env['CCFLAGS'] = ' -pipe -Wall -Wcast-align -Wpointer-arith'
env['CXXFLAGS'] = ' -pipe -Wall -Wcast-align -Wpointer-arith -Wno-deprecated'
env['CXXFLAGS']+= ' -Wold-style-cast -Woverloaded-virtual -ffor-scope'
@@ -79,13 +78,14 @@
BuildDir = 'build.' + VariantName
env['Variant'] = VariantName
env['BuildDir'] = BuildDir
+ env['AbsObjRoot'] = env.Dir(BuildDir).abspath
+ env['AbsSrcRoot'] = env.Dir('#').abspath
env['LIBPATH'] = [
pjoin('#',BuildDir,'hlvm/Base'),
pjoin('#',BuildDir,'hlvm/AST'),
pjoin('#',BuildDir,'hlvm/Reader/XML'),
pjoin('#',BuildDir,'hlvm/Writer/XML')
];
- print 'LIBPATH=',env['LIBPATH']
env.BuildDir(pjoin(BuildDir,'hlvm'),'hlvm',duplicate=0)
env.BuildDir(pjoin(BuildDir,'tools'),'tools',duplicate=0)
env.Prepend(CPPPATH=[pjoin('#',BuildDir)])
Modified: hlvm/trunk/scons/filterbuilders.py
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/scons/filterbuilders.py?rev=38081&r1=38080&r2=38081&view=diff
==============================================================================
--- hlvm/trunk/scons/filterbuilders.py (original)
+++ hlvm/trunk/scons/filterbuilders.py Sat Jul 7 18:59:39 2007
@@ -20,6 +20,7 @@
def QuoteSourceAction(target,source,env):
substs = [['[\\\\]','\\\\\\\\'],['"','\\"'],['^(.*)$','"\\1"']]
_sedit(source,target,substs)
+ return 0
def QuoteSourceMessage(target,source,env):
return "Converting %s to %s as quoted source" % (source[0],target[0])
@@ -110,4 +111,5 @@
a = env.Action(RNGTokenizerAction,RNGTokenizerMessage)
b = env.Builder(action=a,suffix='h',src_suffix='rng',single_source=1)
env.Append(BUILDERS = {'RNGTokenizer':b})
+ return 1
Modified: hlvm/trunk/scons/main.py
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/scons/main.py?rev=38081&r1=38080&r2=38081&view=diff
==============================================================================
--- hlvm/trunk/scons/main.py (original)
+++ hlvm/trunk/scons/main.py Sat Jul 7 18:59:39 2007
@@ -34,5 +34,13 @@
from scons import filterbuilders
return filterbuilders.RNGTokenizer(env)
+def GetCheck(env):
+ from scons import check
+ return check.Check(env)
+
+def Dirs(env,dirlist=[]):
+ for d in dirlist:
+ env.SConscript(path.join(env['BuildDir'],d,'SConscript'))
+
def join(one,two):
return path.join([one,two])
Added: hlvm/trunk/test/SConscript
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/test/SConscript?rev=38081&view=auto
==============================================================================
--- hlvm/trunk/test/SConscript (added)
+++ hlvm/trunk/test/SConscript Sat Jul 7 18:59:39 2007
@@ -0,0 +1,3 @@
+#
+Import('env')
+from scons import main
Modified: hlvm/trunk/test/lib/identity.exp
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/test/lib/identity.exp?rev=38081&r1=38080&r2=38081&view=diff
==============================================================================
--- hlvm/trunk/test/lib/identity.exp (original)
+++ hlvm/trunk/test/lib/identity.exp Sat Jul 7 18:59:39 2007
@@ -23,7 +23,7 @@
proc hlvm-identity-tests { prog pat } {
global srcdir subdir objdir tmpdir objrootdir
set outdir [file join $objdir $subdir]
- set tool [file join $objrootdir Debug bin $prog ]
+ set tool [file join $objrootdir tools $prog $prog ]
set source [file join $srcdir $subdir ]
set files [lsort [
glob -nocomplain -tails -types {f r} -directory $source $pat]]
More information about the llvm-commits
mailing list