summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam Deegan <bill@baddogconsulting.com>2016-11-28 08:53:37 -0800
committerWilliam Deegan <bill@baddogconsulting.com>2016-11-28 08:53:37 -0800
commitc6bad1d59576348df5ba54abe6703c448469cfaf (patch)
tree566428089b48f80bab14789ec4e3d77b8d003477
parentcfb02848f9cbd9d9cdd5416c84eb1ce34c045506 (diff)
downloadscons-c6bad1d59576348df5ba54abe6703c448469cfaf.tar.gz
Fix tests failing on win32 AR and Fortran and M4
-rw-r--r--src/engine/SCons/Tool/__init__.py2
-rw-r--r--src/engine/SCons/Tool/ar.py4
-rw-r--r--test/AR/ARCOM.py2
-rw-r--r--test/AR/ARCOMSTR.py1
-rw-r--r--test/Fortran/F03COM.py18
-rw-r--r--test/Fortran/F08COM.py16
-rw-r--r--test/Fortran/F77COM.py17
-rw-r--r--test/Fortran/F90COM.py20
-rw-r--r--test/Fortran/F95COM.py18
-rw-r--r--test/Fortran/FORTRANCOM.py15
-rw-r--r--test/Fortran/SHF77COM.py16
-rw-r--r--test/Fortran/SHF90COM.py19
-rw-r--r--test/Fortran/SHF95COM.py18
-rw-r--r--test/Fortran/SHFORTRANCOM.py14
-rw-r--r--test/M4/M4.py8
15 files changed, 132 insertions, 56 deletions
diff --git a/src/engine/SCons/Tool/__init__.py b/src/engine/SCons/Tool/__init__.py
index 45d0aa1c..15c8109e 100644
--- a/src/engine/SCons/Tool/__init__.py
+++ b/src/engine/SCons/Tool/__init__.py
@@ -263,7 +263,7 @@ def createStaticLibBuilder(env):
static_lib = env['BUILDERS']['StaticLibrary']
except KeyError:
action_list = [ SCons.Action.Action("$ARCOM", "$ARCOMSTR") ]
- if env.Detect('ranlib'):
+ if env.get('RANLIB',False) or env.Detect('ranlib'):
ranlib_action = SCons.Action.Action("$RANLIBCOM", "$RANLIBCOMSTR")
action_list.append(ranlib_action)
diff --git a/src/engine/SCons/Tool/ar.py b/src/engine/SCons/Tool/ar.py
index 0c3ac093..2cd15c84 100644
--- a/src/engine/SCons/Tool/ar.py
+++ b/src/engine/SCons/Tool/ar.py
@@ -48,8 +48,8 @@ def generate(env):
env['LIBPREFIX'] = 'lib'
env['LIBSUFFIX'] = '.a'
- if env.Detect('ranlib'):
- env['RANLIB'] = 'ranlib'
+ if env.get('RANLIB',env.Detect('ranlib')) :
+ env['RANLIB'] = env.get('RANLIB','ranlib')
env['RANLIBFLAGS'] = SCons.Util.CLVar('')
env['RANLIBCOM'] = '$RANLIB $RANLIBFLAGS $TARGET'
diff --git a/test/AR/ARCOM.py b/test/AR/ARCOM.py
index f9d00382..9ae5b9fb 100644
--- a/test/AR/ARCOM.py
+++ b/test/AR/ARCOM.py
@@ -40,6 +40,7 @@ test.file_fixture('myrewrite.py')
test.write('SConstruct', """
env = Environment(tools=['default', 'ar'],
ARCOM = r'%(_python_)s mycompile.py ar $TARGET $SOURCES',
+ RANLIB = True,
RANLIBCOM = r'%(_python_)s myrewrite.py ranlib $TARGET',
LIBPREFIX = '',
LIBSUFFIX = '.lib')
@@ -49,6 +50,7 @@ env.Library(target = 'output', source = ['file.1', 'file.2'])
test.write('file.1', "file.1\n/*ar*/\n/*ranlib*/\n")
test.write('file.2', "file.2\n/*ar*/\n/*ranlib*/\n")
+
test.run(arguments = '.')
test.must_match('output.lib', "file.1\nfile.2\n")
diff --git a/test/AR/ARCOMSTR.py b/test/AR/ARCOMSTR.py
index 3235f120..a3a9c8e5 100644
--- a/test/AR/ARCOMSTR.py
+++ b/test/AR/ARCOMSTR.py
@@ -42,6 +42,7 @@ test.write('SConstruct', """
env = Environment(tools=['default', 'ar'],
ARCOM = r'%(_python_)s mycompile.py ar $TARGET $SOURCES',
ARCOMSTR = 'Archiving $TARGET from $SOURCES',
+ RANLIB = True,
RANLIBCOM = r'%(_python_)s myrewrite.py ranlib $TARGET',
LIBPREFIX = '',
LIBSUFFIX = '.lib')
diff --git a/test/Fortran/F03COM.py b/test/Fortran/F03COM.py
index 4a42d22f..aaa790c7 100644
--- a/test/Fortran/F03COM.py
+++ b/test/Fortran/F03COM.py
@@ -25,6 +25,9 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import TestSCons
+import sys
+
+is_windows = (sys.platform == 'win32')
_python_ = TestSCons._python_
_exe = TestSCons._exe
@@ -76,18 +79,23 @@ test.write('test22.F03', "This is a .F03 file.\n#link\n/*f03pp*/\n")
test.run(arguments = '.', stderr = None)
test.must_match('test01' + _exe, "This is a .f file.\n")
-test.must_match('test02' + _exe, "This is a .F file.\n")
test.must_match('test03' + _exe, "This is a .for file.\n")
-test.must_match('test04' + _exe, "This is a .FOR file.\n")
test.must_match('test05' + _exe, "This is a .ftn file.\n")
-test.must_match('test06' + _exe, "This is a .FTN file.\n")
test.must_match('test07' + _exe, "This is a .fpp file.\n")
test.must_match('test08' + _exe, "This is a .FPP file.\n")
test.must_match('test13' + _exe, "This is a .f03 file.\n")
-test.must_match('test14' + _exe, "This is a .F03 file.\n")
test.must_match('test21' + _exe, "This is a .f03 file.\n")
-test.must_match('test22' + _exe, "This is a .F03 file.\n")
+
+if not is_windows:
+ # Skip checking files we expect to differ in behavior
+ # based on file extension case
+ test.must_match('test02' + _exe, "This is a .F file.\n")
+ test.must_match('test04' + _exe, "This is a .FOR file.\n")
+ test.must_match('test06' + _exe, "This is a .FTN file.\n")
+ test.must_match('test14' + _exe, "This is a .F03 file.\n")
+ test.must_match('test22' + _exe, "This is a .F03 file.\n")
+
test.pass_test()
diff --git a/test/Fortran/F08COM.py b/test/Fortran/F08COM.py
index ba7d64ec..f159a53c 100644
--- a/test/Fortran/F08COM.py
+++ b/test/Fortran/F08COM.py
@@ -25,6 +25,9 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import TestSCons
+import sys
+
+is_windows = ( sys.platform =='win32')
_python_ = TestSCons._python_
_exe = TestSCons._exe
@@ -67,15 +70,18 @@ test.write('test10.F08', "This is a .F08 file.\n#link\n/*f08pp*/\n")
test.run(arguments = '.', stderr = None)
test.must_match('test01' + _exe, "This is a .f file.\n")
-test.must_match('test02' + _exe, "This is a .F file.\n")
test.must_match('test03' + _exe, "This is a .for file.\n")
-test.must_match('test04' + _exe, "This is a .FOR file.\n")
test.must_match('test05' + _exe, "This is a .ftn file.\n")
-test.must_match('test06' + _exe, "This is a .FTN file.\n")
test.must_match('test07' + _exe, "This is a .fpp file.\n")
-test.must_match('test08' + _exe, "This is a .FPP file.\n")
test.must_match('test09' + _exe, "This is a .f08 file.\n")
-test.must_match('test10' + _exe, "This is a .F08 file.\n")
+if not is_windows:
+ # Skip checking files we expect to differ in behavior
+ # based on file extension case
+ test.must_match('test02' + _exe, "This is a .F file.\n")
+ test.must_match('test04' + _exe, "This is a .FOR file.\n")
+ test.must_match('test06' + _exe, "This is a .FTN file.\n")
+ test.must_match('test08' + _exe, "This is a .FPP file.\n")
+ test.must_match('test10' + _exe, "This is a .F08 file.\n")
test.pass_test()
diff --git a/test/Fortran/F77COM.py b/test/Fortran/F77COM.py
index e7a3ccaa..6550d924 100644
--- a/test/Fortran/F77COM.py
+++ b/test/Fortran/F77COM.py
@@ -25,6 +25,9 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import TestSCons
+import sys
+
+is_windows = ( sys.platform =='win32')
_python_ = TestSCons._python_
_exe = TestSCons._exe
@@ -67,15 +70,19 @@ test.write('test10.F77', "This is a .F77 file.\n#link\n/*f77pp*/\n")
test.run(arguments = '.', stderr = None)
test.must_match('test01' + _exe, "This is a .f file.\n")
-test.must_match('test02' + _exe, "This is a .F file.\n")
test.must_match('test03' + _exe, "This is a .for file.\n")
-test.must_match('test04' + _exe, "This is a .FOR file.\n")
test.must_match('test05' + _exe, "This is a .ftn file.\n")
-test.must_match('test06' + _exe, "This is a .FTN file.\n")
test.must_match('test07' + _exe, "This is a .fpp file.\n")
-test.must_match('test08' + _exe, "This is a .FPP file.\n")
test.must_match('test09' + _exe, "This is a .f77 file.\n")
-test.must_match('test10' + _exe, "This is a .F77 file.\n")
+
+if not is_windows:
+ # Skip checking files we expect to differ in behavior
+ # based on file extension case
+ test.must_match('test02' + _exe, "This is a .F file.\n")
+ test.must_match('test04' + _exe, "This is a .FOR file.\n")
+ test.must_match('test06' + _exe, "This is a .FTN file.\n")
+ test.must_match('test08' + _exe, "This is a .FPP file.\n")
+ test.must_match('test10' + _exe, "This is a .F77 file.\n")
test.pass_test()
diff --git a/test/Fortran/F90COM.py b/test/Fortran/F90COM.py
index a4f37c22..180e6b73 100644
--- a/test/Fortran/F90COM.py
+++ b/test/Fortran/F90COM.py
@@ -25,6 +25,9 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import TestSCons
+import sys
+
+is_windows = ( sys.platform =='win32')
_python_ = TestSCons._python_
_exe = TestSCons._exe
@@ -76,18 +79,23 @@ test.write('test22.F90', "This is a .F90 file.\n#link\n/*f90pp*/\n")
test.run(arguments = '.', stderr = None)
test.must_match('test01' + _exe, "This is a .f file.\n")
-test.must_match('test02' + _exe, "This is a .F file.\n")
test.must_match('test03' + _exe, "This is a .for file.\n")
-test.must_match('test04' + _exe, "This is a .FOR file.\n")
test.must_match('test05' + _exe, "This is a .ftn file.\n")
-test.must_match('test06' + _exe, "This is a .FTN file.\n")
test.must_match('test07' + _exe, "This is a .fpp file.\n")
-test.must_match('test08' + _exe, "This is a .FPP file.\n")
test.must_match('test11' + _exe, "This is a .f90 file.\n")
-test.must_match('test12' + _exe, "This is a .F90 file.\n")
test.must_match('test21' + _exe, "This is a .f90 file.\n")
-test.must_match('test22' + _exe, "This is a .F90 file.\n")
+
+if not is_windows:
+ # Skip checking files we expect to differ in behavior
+ # based on file extension case
+ test.must_match('test02' + _exe, "This is a .F file.\n")
+ test.must_match('test04' + _exe, "This is a .FOR file.\n")
+ test.must_match('test06' + _exe, "This is a .FTN file.\n")
+ test.must_match('test08' + _exe, "This is a .FPP file.\n")
+ test.must_match('test12' + _exe, "This is a .F90 file.\n")
+ test.must_match('test22' + _exe, "This is a .F90 file.\n")
+
test.pass_test()
diff --git a/test/Fortran/F95COM.py b/test/Fortran/F95COM.py
index 32ae5948..2d487701 100644
--- a/test/Fortran/F95COM.py
+++ b/test/Fortran/F95COM.py
@@ -25,6 +25,9 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import TestSCons
+import sys
+
+is_windows = ( sys.platform =='win32')
_python_ = TestSCons._python_
_exe = TestSCons._exe
@@ -76,18 +79,21 @@ test.write('test22.F95', "This is a .F95 file.\n#link\n/*f95pp*/\n")
test.run(arguments = '.', stderr = None)
test.must_match('test01' + _exe, "This is a .f file.\n")
-test.must_match('test02' + _exe, "This is a .F file.\n")
test.must_match('test03' + _exe, "This is a .for file.\n")
-test.must_match('test04' + _exe, "This is a .FOR file.\n")
test.must_match('test05' + _exe, "This is a .ftn file.\n")
-test.must_match('test06' + _exe, "This is a .FTN file.\n")
test.must_match('test07' + _exe, "This is a .fpp file.\n")
-test.must_match('test08' + _exe, "This is a .FPP file.\n")
test.must_match('test13' + _exe, "This is a .f95 file.\n")
-test.must_match('test14' + _exe, "This is a .F95 file.\n")
test.must_match('test21' + _exe, "This is a .f95 file.\n")
-test.must_match('test22' + _exe, "This is a .F95 file.\n")
+if not is_windows:
+ # Skip checking files we expect to differ in behavior
+ # based on file extension case
+ test.must_match('test02' + _exe, "This is a .F file.\n")
+ test.must_match('test04' + _exe, "This is a .FOR file.\n")
+ test.must_match('test06' + _exe, "This is a .FTN file.\n")
+ test.must_match('test08' + _exe, "This is a .FPP file.\n")
+ test.must_match('test14' + _exe, "This is a .F95 file.\n")
+ test.must_match('test22' + _exe, "This is a .F95 file.\n")
test.pass_test()
diff --git a/test/Fortran/FORTRANCOM.py b/test/Fortran/FORTRANCOM.py
index a07d427e..d3d7e7f7 100644
--- a/test/Fortran/FORTRANCOM.py
+++ b/test/Fortran/FORTRANCOM.py
@@ -25,6 +25,10 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import TestSCons
+import sys
+
+is_windows = ( sys.platform =='win32')
+
_python_ = TestSCons._python_
_exe = TestSCons._exe
@@ -61,13 +65,16 @@ test.write('test08.FPP', "This is a .FPP file.\n#link\n/*fortranpp*/\n")
test.run(arguments = '.', stderr = None)
test.must_match('test01' + _exe, "This is a .f file.\n")
-test.must_match('test02' + _exe, "This is a .F file.\n")
test.must_match('test03' + _exe, "This is a .for file.\n")
-test.must_match('test04' + _exe, "This is a .FOR file.\n")
test.must_match('test05' + _exe, "This is a .ftn file.\n")
-test.must_match('test06' + _exe, "This is a .FTN file.\n")
test.must_match('test07' + _exe, "This is a .fpp file.\n")
-test.must_match('test08' + _exe, "This is a .FPP file.\n")
+if not is_windows:
+ # Skip checking files we expect to differ in behavior
+ # based on file extension case
+ test.must_match('test02' + _exe, "This is a .F file.\n")
+ test.must_match('test04' + _exe, "This is a .FOR file.\n")
+ test.must_match('test06' + _exe, "This is a .FTN file.\n")
+ test.must_match('test08' + _exe, "This is a .FPP file.\n")
test.pass_test()
diff --git a/test/Fortran/SHF77COM.py b/test/Fortran/SHF77COM.py
index 9289fa3f..bd3d1e2c 100644
--- a/test/Fortran/SHF77COM.py
+++ b/test/Fortran/SHF77COM.py
@@ -25,6 +25,9 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import TestSCons
+import sys
+
+is_windows = ( sys.platform =='win32')
_python_ = TestSCons._python_
_obj = TestSCons._shobj
@@ -65,15 +68,18 @@ test.write('test10.F77', "This is a .F77 file.\n/*f77pp*/\n")
test.run(arguments = '.', stderr = None)
test.must_match(obj_ + 'test01' + _obj, "This is a .f file.\n")
-test.must_match(obj_ + 'test02' + _obj, "This is a .F file.\n")
test.must_match(obj_ + 'test03' + _obj, "This is a .for file.\n")
-test.must_match(obj_ + 'test04' + _obj, "This is a .FOR file.\n")
test.must_match(obj_ + 'test05' + _obj, "This is a .ftn file.\n")
-test.must_match(obj_ + 'test06' + _obj, "This is a .FTN file.\n")
test.must_match(obj_ + 'test07' + _obj, "This is a .fpp file.\n")
-test.must_match(obj_ + 'test08' + _obj, "This is a .FPP file.\n")
test.must_match(obj_ + 'test09' + _obj, "This is a .f77 file.\n")
-test.must_match(obj_ + 'test10' + _obj, "This is a .F77 file.\n")
+if not is_windows:
+ # Skip checking files we expect to differ in behavior
+ # based on file extension case
+ test.must_match(obj_ + 'test02' + _obj, "This is a .F file.\n")
+ test.must_match(obj_ + 'test04' + _obj, "This is a .FOR file.\n")
+ test.must_match(obj_ + 'test06' + _obj, "This is a .FTN file.\n")
+ test.must_match(obj_ + 'test08' + _obj, "This is a .FPP file.\n")
+ test.must_match(obj_ + 'test10' + _obj, "This is a .F77 file.\n")
test.pass_test()
diff --git a/test/Fortran/SHF90COM.py b/test/Fortran/SHF90COM.py
index 9eef8b62..f66c3470 100644
--- a/test/Fortran/SHF90COM.py
+++ b/test/Fortran/SHF90COM.py
@@ -25,6 +25,10 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import TestSCons
+import sys
+
+is_windows = ( sys.platform =='win32')
+
_python_ = TestSCons._python_
_obj = TestSCons._shobj
@@ -72,18 +76,21 @@ test.write('test22.F90', "This is a .F90 file.\n/*f90pp*/\n")
test.run(arguments = '.', stderr = None)
test.must_match(obj_ + 'test01' + _obj, "This is a .f file.\n")
-test.must_match(obj_ + 'test02' + _obj, "This is a .F file.\n")
test.must_match(obj_ + 'test03' + _obj, "This is a .for file.\n")
-test.must_match(obj_ + 'test04' + _obj, "This is a .FOR file.\n")
test.must_match(obj_ + 'test05' + _obj, "This is a .ftn file.\n")
-test.must_match(obj_ + 'test06' + _obj, "This is a .FTN file.\n")
test.must_match(obj_ + 'test07' + _obj, "This is a .fpp file.\n")
-test.must_match(obj_ + 'test08' + _obj, "This is a .FPP file.\n")
test.must_match(obj_ + 'test11' + _obj, "This is a .f90 file.\n")
-test.must_match(obj_ + 'test12' + _obj, "This is a .F90 file.\n")
test.must_match(obj_ + 'test21' + _obj, "This is a .f90 file.\n")
-test.must_match(obj_ + 'test22' + _obj, "This is a .F90 file.\n")
+if not is_windows:
+ # Skip checking files we expect to differ in behavior
+ # based on file extension case
+ test.must_match(obj_ + 'test02' + _obj, "This is a .F file.\n")
+ test.must_match(obj_ + 'test04' + _obj, "This is a .FOR file.\n")
+ test.must_match(obj_ + 'test06' + _obj, "This is a .FTN file.\n")
+ test.must_match(obj_ + 'test08' + _obj, "This is a .FPP file.\n")
+ test.must_match(obj_ + 'test12' + _obj, "This is a .F90 file.\n")
+ test.must_match(obj_ + 'test22' + _obj, "This is a .F90 file.\n")
test.pass_test()
diff --git a/test/Fortran/SHF95COM.py b/test/Fortran/SHF95COM.py
index e31cf45f..85de45e1 100644
--- a/test/Fortran/SHF95COM.py
+++ b/test/Fortran/SHF95COM.py
@@ -25,6 +25,9 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import TestSCons
+import sys
+
+is_windows = ( sys.platform =='win32')
_python_ = TestSCons._python_
_obj = TestSCons._shobj
@@ -72,18 +75,21 @@ test.write('test22.F95', "This is a .F95 file.\n/*f95pp*/\n")
test.run(arguments = '.', stderr = None)
test.must_match(obj_ + 'test01' + _obj, "This is a .f file.\n")
-test.must_match(obj_ + 'test02' + _obj, "This is a .F file.\n")
test.must_match(obj_ + 'test03' + _obj, "This is a .for file.\n")
-test.must_match(obj_ + 'test04' + _obj, "This is a .FOR file.\n")
test.must_match(obj_ + 'test05' + _obj, "This is a .ftn file.\n")
-test.must_match(obj_ + 'test06' + _obj, "This is a .FTN file.\n")
test.must_match(obj_ + 'test07' + _obj, "This is a .fpp file.\n")
-test.must_match(obj_ + 'test08' + _obj, "This is a .FPP file.\n")
test.must_match(obj_ + 'test13' + _obj, "This is a .f95 file.\n")
-test.must_match(obj_ + 'test14' + _obj, "This is a .F95 file.\n")
test.must_match(obj_ + 'test21' + _obj, "This is a .f95 file.\n")
-test.must_match(obj_ + 'test22' + _obj, "This is a .F95 file.\n")
+if not is_windows:
+ # Skip checking files we expect to differ in behavior
+ # based on file extension case
+ test.must_match(obj_ + 'test02' + _obj, "This is a .F file.\n")
+ test.must_match(obj_ + 'test04' + _obj, "This is a .FOR file.\n")
+ test.must_match(obj_ + 'test06' + _obj, "This is a .FTN file.\n")
+ test.must_match(obj_ + 'test08' + _obj, "This is a .FPP file.\n")
+ test.must_match(obj_ + 'test14' + _obj, "This is a .F95 file.\n")
+ test.must_match(obj_ + 'test22' + _obj, "This is a .F95 file.\n")
test.pass_test()
diff --git a/test/Fortran/SHFORTRANCOM.py b/test/Fortran/SHFORTRANCOM.py
index 56958b21..5c42864b 100644
--- a/test/Fortran/SHFORTRANCOM.py
+++ b/test/Fortran/SHFORTRANCOM.py
@@ -25,6 +25,9 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import TestSCons
+import sys
+
+is_windows = ( sys.platform =='win32')
_python_ = TestSCons._python_
_obj = TestSCons._shobj
@@ -59,13 +62,16 @@ test.write('test08.FPP', "This is a .FPP file.\n/*fortranpp*/\n")
test.run(arguments = '.', stderr = None)
test.must_match(obj_ + 'test01' + _obj, "This is a .f file.\n")
-test.must_match(obj_ + 'test02' + _obj, "This is a .F file.\n")
test.must_match(obj_ + 'test03' + _obj, "This is a .for file.\n")
-test.must_match(obj_ + 'test04' + _obj, "This is a .FOR file.\n")
test.must_match(obj_ + 'test05' + _obj, "This is a .ftn file.\n")
-test.must_match(obj_ + 'test06' + _obj, "This is a .FTN file.\n")
test.must_match(obj_ + 'test07' + _obj, "This is a .fpp file.\n")
-test.must_match(obj_ + 'test08' + _obj, "This is a .FPP file.\n")
+if not is_windows:
+ # Skip checking files we expect to differ in behavior
+ # based on file extension case
+ test.must_match(obj_ + 'test02' + _obj, "This is a .F file.\n")
+ test.must_match(obj_ + 'test04' + _obj, "This is a .FOR file.\n")
+ test.must_match(obj_ + 'test06' + _obj, "This is a .FTN file.\n")
+ test.must_match(obj_ + 'test08' + _obj, "This is a .FPP file.\n")
test.pass_test()
diff --git a/test/M4/M4.py b/test/M4/M4.py
index 4306558f..76010e62 100644
--- a/test/M4/M4.py
+++ b/test/M4/M4.py
@@ -59,7 +59,13 @@ line 3
test.run()
-test.must_match(test.workpath('aaa.x'), "line 1\nmym4.py\nline 3\n")
+import sys
+
+if sys.platform == 'win32':
+ # Handle carriage returns.
+ test.must_match(test.workpath('aaa.x'), "line 1\r\nmym4.py\r\nline 3\r\n")
+else:
+ test.must_match(test.workpath('aaa.x'), "line 1\nmym4.py\nline 3\n")