Win32 portability.
authorstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Mon, 14 Feb 2005 16:08:52 +0000 (16:08 +0000)
committerstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Mon, 14 Feb 2005 16:08:52 +0000 (16:08 +0000)
git-svn-id: http://scons.tigris.org/svn/scons/trunk@1230 fdb21ef1-2011-0410-befe-b5e4ea1792b1

src/engine/SCons/Tool/mslink.py
test/MSVC/msvc.py
test/option/debug-tree.py

index 559a679482e1659618dbd9aef8a7d538a8259e4c..e05530e84b66992d44f5a5c919c1337c55531686 100644 (file)
@@ -186,7 +186,11 @@ def generate(env):
     env['LDMODULEPREFIX'] = '$SHLIBPREFIX' 
     env['LDMODULESUFFIX'] = '$SHLIBSUFFIX' 
     env['LDMODULEFLAGS'] = '$SHLINKFLAGS'
-    env['LDMODULECOM'] = '$SHLINKCOM'
+    # We can't use '$SHLINKCOM' here because that will stringify the
+    # action list on expansion, and will then try to execute expanded
+    # strings, with the upshot that it would try to execute RegServerFunc
+    # as a command.
+    env['LDMODULECOM'] = compositeLinkAction
 
 def exists(env):
     if SCons.Tool.msvs.is_msvs_installed():
index fe5bfee95fd727f9fb45deccad3fdcc2c691901e..c3a9fdccc968d1693d340aa58499ca14708bdf6d 100644 (file)
@@ -91,20 +91,23 @@ test.write('StdAfx.cpp', '''
 #include "StdAfx.h"
 ''')
 
-test.run(arguments='test.exe')
+#  Visual Studio 8 has deprecated the /Yd option and prints warnings
+#  about it, so ignore stderr when running SCons.
 
-test.fail_test(not os.path.exists(test.workpath('test.exe')))
-test.fail_test(not os.path.exists(test.workpath('test.res')))
-test.fail_test(not os.path.exists(test.workpath('test.pdb')))
-test.fail_test(not os.path.exists(test.workpath('StdAfx.pch')))
-test.fail_test(not os.path.exists(test.workpath('StdAfx.obj')))
+test.run(arguments='test.exe', stderr=None)
+
+test.must_exist(test.workpath('test.exe'))
+test.must_exist(test.workpath('test.res'))
+test.must_exist(test.workpath('test.pdb'))
+test.must_exist(test.workpath('StdAfx.pch'))
+test.must_exist(test.workpath('StdAfx.obj'))
 
 test.run(program=test.workpath('test.exe'), stdout='2001 test 1\n')
 
 test.write('resource.h', '''
 #define IDS_TEST 2002
 ''')
-test.run(arguments='test.exe')
+test.run(arguments='test.exe', stderr=None)
 test.run(program=test.workpath('test.exe'), stdout='2002 test 1\n')
 
 test.write('test.rc', '''
@@ -115,54 +118,54 @@ BEGIN
     IDS_TEST "test 2"
 END
 ''')
-test.run(arguments='test.exe')
+test.run(arguments='test.exe', stderr=None)
 test.run(program=test.workpath('test.exe'), stdout='2002 test 2\n')
 
 test.run(arguments='-c .')
 
-test.fail_test(os.path.exists(test.workpath('test.exe')))
-test.fail_test(os.path.exists(test.workpath('test.pdb')))
-test.fail_test(os.path.exists(test.workpath('test.res')))
-test.fail_test(os.path.exists(test.workpath('StdAfx.pch')))
-test.fail_test(os.path.exists(test.workpath('StdAfx.obj')))
+test.must_not_exist(test.workpath('test.exe'))
+test.must_not_exist(test.workpath('test.pdb'))
+test.must_not_exist(test.workpath('test.res'))
+test.must_not_exist(test.workpath('StdAfx.pch'))
+test.must_not_exist(test.workpath('StdAfx.obj'))
 
-test.run(arguments='test.exe')
+test.run(arguments='test.exe', stderr=None)
 
-test.fail_test(not os.path.exists(test.workpath('test.pdb')))
-test.fail_test(not os.path.exists(test.workpath('StdAfx.pch')))
-test.fail_test(not os.path.exists(test.workpath('StdAfx.obj')))
+test.must_exist(test.workpath('test.pdb'))
+test.must_exist(test.workpath('StdAfx.pch'))
+test.must_exist(test.workpath('StdAfx.obj'))
 
 test.run(arguments='-c test.pdb')
-test.fail_test(os.path.exists(test.workpath('test.exe')))
-test.fail_test(os.path.exists(test.workpath('test.obj')))
-test.fail_test(os.path.exists(test.workpath('test.pdb')))
-test.fail_test(os.path.exists(test.workpath('StdAfx.pch')))
-test.fail_test(os.path.exists(test.workpath('StdAfx.obj')))
+test.must_not_exist(test.workpath('test.exe'))
+test.must_not_exist(test.workpath('test.obj'))
+test.must_not_exist(test.workpath('test.pdb'))
+test.must_not_exist(test.workpath('StdAfx.pch'))
+test.must_not_exist(test.workpath('StdAfx.obj'))
 
-test.run(arguments='StdAfx.pch')
+test.run(arguments='StdAfx.pch', stderr=None)
 
-test.fail_test(os.path.exists(test.workpath('test.pdb')))
-test.fail_test(not os.path.exists(test.workpath('StdAfx.pch')))
-test.fail_test(not os.path.exists(test.workpath('StdAfx.obj')))
+test.must_not_exist(test.workpath('test.pdb'))
+test.must_exist(test.workpath('StdAfx.pch'))
+test.must_exist(test.workpath('StdAfx.obj'))
 
 test.run(arguments='-c test.exe')
-test.fail_test(os.path.exists(test.workpath('test.exe')))
-test.fail_test(os.path.exists(test.workpath('test.obj')))
-test.fail_test(os.path.exists(test.workpath('test.pdb')))
-test.fail_test(os.path.exists(test.workpath('StdAfx.pch')))
-test.fail_test(os.path.exists(test.workpath('StdAfx.obj')))
+test.must_not_exist(test.workpath('test.exe'))
+test.must_not_exist(test.workpath('test.obj'))
+test.must_not_exist(test.workpath('test.pdb'))
+test.must_not_exist(test.workpath('StdAfx.pch'))
+test.must_not_exist(test.workpath('StdAfx.obj'))
 
-test.run(arguments='test.obj')
-test.fail_test(os.path.exists(test.workpath('test.pdb')))
-test.fail_test(not os.path.exists(test.workpath('test.obj')))
+test.run(arguments='test.obj', stderr=None)
+test.must_not_exist(test.workpath('test.pdb'))
+test.must_exist(test.workpath('test.obj'))
 
 
 start = time.time()
-test.run(arguments='fast.obj')
+test.run(arguments='fast.obj', stderr=None)
 fast = time.time() - start
 
 start = time.time()
-test.run(arguments='slow.obj')
+test.run(arguments='slow.obj', stderr=None)
 slow = time.time() - start
 
 # using precompiled headers should be significantly faster
@@ -173,9 +176,9 @@ test.write('resource.h', '''
 #define IDS_TEST 2003
 ''')
 
-test.not_up_to_date(arguments='test.res')
-test.not_up_to_date(arguments='StdAfx.pch')
-test.not_up_to_date(arguments='test.exe')
+test.not_up_to_date(arguments='test.res', stderr=None)
+test.not_up_to_date(arguments='StdAfx.pch', stderr=None)
+test.not_up_to_date(arguments='test.exe', stderr=None)
 test.run(program=test.workpath('test.exe'), stdout='2003 test 2\n')
 
 
@@ -215,17 +218,17 @@ test.write('src/StdAfx.cpp', '''
 #include "StdAfx.h"
 ''')
 
-test.run(arguments='out')
+test.run(arguments='out', stderr=None)
 
-test.fail_test(not os.path.exists(test.workpath('out/test.pdb')))
-test.fail_test(not os.path.exists(test.workpath('build/StdAfx.pch')))
-test.fail_test(not os.path.exists(test.workpath('build/StdAfx.obj')))
+test.must_exist(test.workpath('out/test.pdb'))
+test.must_exist(test.workpath('build/StdAfx.pch'))
+test.must_exist(test.workpath('build/StdAfx.obj'))
 
 test.run(arguments='-c out')
 
-test.fail_test(os.path.exists(test.workpath('out/test.pdb')))
-test.fail_test(os.path.exists(test.workpath('build/StdAfx.pch')))
-test.fail_test(os.path.exists(test.workpath('build/StdAfx.obj'))) 
+test.must_not_exist(test.workpath('out/test.pdb'))
+test.must_not_exist(test.workpath('build/StdAfx.pch'))
+test.must_not_exist(test.workpath('build/StdAfx.obj'))
 
 #####
 # Test error reporting
index e7847afd942e3c783d4de3b18e1b842e18407ea8..975e9b35a1e9587e66ce91a5fa9934c402ade836 100644 (file)
@@ -39,11 +39,15 @@ test = TestSCons.TestSCons()
 
 test.write('SConstruct', """
 env = Environment(OBJSUFFIX = '.ooo', PROGSUFFIX = '.xxx')
-env.Program('foo', Split('foo.c bar.c'))
+env.Program('Foo', Split('Foo.c Bar.c'))
 """)
 
-test.write('foo.c', r"""
-#include "foo.h"
+# N.B.:  We use upper-case file names (Foo* and Bar*) so that the sorting
+# order with our upper-case SConstruct file is the same on case-sensitive
+# (UNIX/Linux) and case-insensitive (Windows) systems.
+
+test.write('Foo.c', r"""
+#include "Foo.h"
 int main(int argc, char *argv[])
 {
        argv[argc++] = "--";
@@ -52,75 +56,75 @@ int main(int argc, char *argv[])
 }
 """)
 
-test.write('bar.c', """
-#include "bar.h"
+test.write('Bar.c', """
+#include "Bar.h"
 """)
 
-test.write('foo.h', """
+test.write('Foo.h', """
 #ifndef FOO_H
 #define FOO_H
-#include "bar.h"
+#include "Bar.h"
 #endif
 """)
 
-test.write('bar.h', """
+test.write('Bar.h', """
 #ifndef BAR_H
 #define BAR_H
-#include "foo.h"
+#include "Foo.h"
 #endif
 """)
 
 tree1 = """
-+-foo.xxx
-  +-foo.ooo
-  | +-foo.c
-  | +-foo.h
-  | +-bar.h
-  +-bar.ooo
-    +-bar.c
-    +-bar.h
-    +-foo.h
++-Foo.xxx
+  +-Foo.ooo
+  | +-Foo.c
+  | +-Foo.h
+  | +-Bar.h
+  +-Bar.ooo
+    +-Bar.c
+    +-Bar.h
+    +-Foo.h
 """
 
-test.run(arguments = "--debug=tree foo.xxx")
+test.run(arguments = "--debug=tree Foo.xxx")
 test.fail_test(string.find(test.stdout(), tree1) == -1)
 
 tree2 = """
 +-.
+  +-Bar.c
+  +-Bar.ooo
+  | +-Bar.c
+  | +-Bar.h
+  | +-Foo.h
+  +-Foo.c
+  +-Foo.ooo
+  | +-Foo.c
+  | +-Foo.h
+  | +-Bar.h
+  +-Foo.xxx
+  | +-Foo.ooo
+  | | +-Foo.c
+  | | +-Foo.h
+  | | +-Bar.h
+  | +-Bar.ooo
+  |   +-Bar.c
+  |   +-Bar.h
+  |   +-Foo.h
   +-SConstruct
-  +-bar.c
-  +-bar.ooo
-  | +-bar.c
-  | +-bar.h
-  | +-foo.h
-  +-foo.c
-  +-foo.ooo
-  | +-foo.c
-  | +-foo.h
-  | +-bar.h
-  +-foo.xxx
-    +-foo.ooo
-    | +-foo.c
-    | +-foo.h
-    | +-bar.h
-    +-bar.ooo
-      +-bar.c
-      +-bar.h
-      +-foo.h
 """
 test.run(arguments = "--debug=tree .")
 test.fail_test(string.find(test.stdout(), tree2) == -1)
 
 # Make sure we print the debug stuff even if there's a build failure.
-test.write('bar.h', """
+test.write('Bar.h', """
 #ifndef BAR_H
 #define BAR_H
-#include "foo.h"
+#include "Foo.h"
 #endif
 THIS SHOULD CAUSE A BUILD FAILURE
 """)
 
-test.run(arguments = "--debug=tree foo.xxx",
+test.run(arguments = "--debug=tree Foo.xxx",
          status = 2,
          stderr = None)
 test.fail_test(string.find(test.stdout(), tree1) == -1)