From: GregNoel Date: Sat, 27 Dec 2008 18:30:51 +0000 (+0000) Subject: Fix test to work on OS X; cleanup and simplification X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=da758fb2572aa011df5050c8c3c758db60fedab5;p=scons.git Fix test to work on OS X; cleanup and simplification git-svn-id: http://scons.tigris.org/svn/scons/trunk@3862 fdb21ef1-2011-0410-befe-b5e4ea1792b1 --- diff --git a/test/Repository/SharedLibrary.py b/test/Repository/SharedLibrary.py index 011dc832..697e6ae0 100644 --- a/test/Repository/SharedLibrary.py +++ b/test/Repository/SharedLibrary.py @@ -42,10 +42,7 @@ test = TestSCons.TestSCons() test.subdir('repository', 'work') # -workpath_repository = test.workpath('repository') - -# -opts = '-Y ' + workpath_repository +opts = '-Y ' + test.workpath('repository') # test.write(['repository', 'SConstruct'], """\ @@ -55,43 +52,22 @@ f2 = env.SharedObject('f2.c') f3 = env.SharedObject('f3.c') if ARGUMENTS.get('PROGRAM'): lib = env.SharedLibrary(target = 'foo', - source = ['f1.os', 'f2.os', 'f3.os'], + source = f1 + f2 + f3, WINDOWS_INSERT_DEF = 1) env.Program(target='prog', source='prog.c', LIBS='foo', LIBPATH=['.']) """) -test.write(['repository', 'f1.c'], r""" -#include - -void -f1(void) -{ - printf("f1.c\n"); - fflush(stdout); -} -""") - -test.write(['repository', 'f2.c'], r""" +for fx in ['1', '2', '3']: + test.write(['repository', 'f%s.c' % (fx)], r""" #include void -f2(void) +f%s(void) { - printf("f2.c\n"); + printf("f%s.c\n"); fflush(stdout); } -""") - -test.write(['repository', 'f3.c'], r""" -#include - -void -f3(void) -{ - printf("f3.c\n"); - fflush(stdout); -} -""") +""" % (fx,fx)) test.write(['repository', "foo.def"], r""" LIBRARY "foo" @@ -120,21 +96,26 @@ main(int argc, char *argv[]) } """) +# Build the relocatable objects within the repository test.run(chdir = 'repository', arguments = '.') # Make the repository non-writable, # so we'll detect if we try to write into it accidentally. test.writable('repository', 0) -# +# Build the library and the program within the work area test.run(chdir='work', options=opts, arguments='PROGRAM=1', stderr=TestSCons.noisy_ar, match=TestSCons.match_re_dotall) +# Run the program and verify that the library worked if os.name == 'posix': - os.environ['LD_LIBRARY_PATH'] = test.workpath('work') + if sys.platform[:6] == 'darwin': + os.environ['DYLD_LIBRARY_PATH'] = test.workpath('work') + else: + os.environ['LD_LIBRARY_PATH'] = test.workpath('work') if string.find(sys.platform, 'irix') != -1: os.environ['LD_LIBRARYN32_PATH'] = test.workpath('work')