Skip to content

Commit 516d94b

Browse files
committed
Add - in front of compiler flags for yet more tests
1 parent be87ddd commit 516d94b

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

test/framework/toolchain.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -682,7 +682,7 @@ def test_misc_flags_unique(self):
682682
def test_override_optarch(self):
683683
"""Test whether overriding the optarch flag works."""
684684
flag_vars = ['CFLAGS', 'CXXFLAGS', 'FCFLAGS', 'FFLAGS', 'F90FLAGS']
685-
for optarch_var in ['march=lovelylovelysandybridge', None]:
685+
for optarch_var in ['-march=lovelylovelysandybridge', None]:
686686
init_config(build_options={'optarch': optarch_var, 'silent': True})
687687
for enable in [True, False]:
688688
tc = self.get_toolchain('foss', version='2018a')
@@ -761,15 +761,15 @@ def test_optarch_aarch64_heuristic(self):
761761
tc.set_options({})
762762
with self.mocked_stdout_stderr():
763763
tc.prepare()
764-
self.assertEqual(tc.options.options_map['optarch'], 'mcpu=cortex-a53')
764+
self.assertEqual(tc.options.options_map['optarch'], '-mcpu=cortex-a53')
765765
self.assertIn('-mcpu=cortex-a53', os.environ['CFLAGS'])
766766
self.modtool.purge()
767767

768768
tc = self.get_toolchain("GCCcore", version="6.2.0")
769769
tc.set_options({})
770770
with self.mocked_stdout_stderr():
771771
tc.prepare()
772-
self.assertEqual(tc.options.options_map['optarch'], 'mcpu=native')
772+
self.assertEqual(tc.options.options_map['optarch'], '-mcpu=native')
773773
self.assertIn('-mcpu=native', os.environ['CFLAGS'])
774774
self.modtool.purge()
775775

@@ -778,16 +778,16 @@ def test_optarch_aarch64_heuristic(self):
778778
tc.set_options({})
779779
with self.mocked_stdout_stderr():
780780
tc.prepare()
781-
self.assertEqual(tc.options.options_map['optarch'], 'mcpu=cortex-a72.cortex-a53')
781+
self.assertEqual(tc.options.options_map['optarch'], '-mcpu=cortex-a72.cortex-a53')
782782
self.assertIn('-mcpu=cortex-a72.cortex-a53', os.environ['CFLAGS'])
783783
self.modtool.purge()
784784

785785
def test_compiler_dependent_optarch(self):
786786
"""Test whether specifying optarch on a per compiler basis works."""
787787
flag_vars = ['CFLAGS', 'CXXFLAGS', 'FCFLAGS', 'FFLAGS', 'F90FLAGS']
788-
intel_options = [('intelflag', 'intelflag'), ('GENERIC', 'xSSE2'), ('', '')]
789-
gcc_options = [('gccflag', 'gccflag'), ('march=nocona', 'march=nocona'), ('', '')]
790-
gcccore_options = [('gcccoreflag', 'gcccoreflag'), ('GENERIC', 'march=x86-64 -mtune=generic'), ('', '')]
788+
intel_options = [('intelflag', 'intelflag'), ('GENERIC', '-xSSE2'), ('', '')]
789+
gcc_options = [('gccflag', 'gccflag'), ('-march=nocona', '-march=nocona'), ('', '')]
790+
gcccore_options = [('gcccoreflag', 'gcccoreflag'), ('GENERIC', '-march=x86-64 -mtune=generic'), ('', '')]
791791

792792
tc_intel = ('iccifort', '2018.1.163')
793793
tc_gcc = ('GCC', '6.4.0-2.28')
@@ -849,8 +849,8 @@ def test_compiler_dependent_optarch(self):
849849
gcc_options[1][1],
850850
gcccore_options[0][1],
851851
gcccore_options[1][1],
852-
'xHost', # default optimal for Intel
853-
'march=native', # default optimal for GCC
852+
'-xHost', # default optimal for Intel
853+
'-march=native', # default optimal for GCC
854854
]
855855
else:
856856
blacklist = [flags]
@@ -880,16 +880,16 @@ def test_easyconfig_optarch_flags(self):
880880
toy_txt = read_file(eb_file)
881881

882882
# check that an optarch map raises an error
883-
write_file(test_ec, toy_txt + "\ntoolchainopts = {'optarch': 'GCC:march=sandrybridge;Intel:xAVX'}")
883+
write_file(test_ec, toy_txt + "\ntoolchainopts = {'optarch': 'GCC:-march=sandrybridge;Intel:-xAVX'}")
884884
msg = "syntax is not allowed"
885885
with self.mocked_stdout_stderr():
886886
self.assertErrorRegex(EasyBuildError, msg, self.eb_main, [test_ec], raise_error=True, do_build=True)
887887

888888
# check that setting optarch flags work
889-
write_file(test_ec, toy_txt + "\ntoolchainopts = {'optarch': 'march=sandybridge'}")
889+
write_file(test_ec, toy_txt + "\ntoolchainopts = {'optarch': '-march=sandybridge'}")
890890
with self.mocked_stdout_stderr():
891891
out = self.eb_main([test_ec], raise_error=True, do_build=True)
892-
regex = re.compile("_set_optimal_architecture: using march=sandybridge as optarch for x86_64")
892+
regex = re.compile("_set_optimal_architecture: using -march=sandybridge as optarch for x86_64")
893893
self.assertTrue(regex.search(out), "Pattern '%s' found in: %s" % (regex.pattern, out))
894894

895895
def test_misc_flags_unique_fortran(self):

0 commit comments

Comments
 (0)