tests: hello_se using host tag
authorGiacomo Travaglini <giacomo.travaglini@arm.com>
Fri, 17 Jan 2020 14:09:18 +0000 (14:09 +0000)
committerGiacomo Travaglini <giacomo.travaglini@arm.com>
Mon, 10 Feb 2020 09:57:56 +0000 (09:57 +0000)
This patch is rewriting hello_se to distinguish between statically and
dynamically linked hello worlds.

Change-Id: I03c1add1d1ca568d150f4bacd89b2838a6d27035
Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-by: Ciro Santilli <ciro.santilli@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/24528
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Maintainer: Bobby R. Bruce <bbruce@ucdavis.edu>

tests/gem5/hello_se/test_hello_se.py

index 74d7fb1a6bb362c32557303d9f86ffa8877774d3..39c1529104311aedce191e0dfc26c663f72abbfa 100644 (file)
@@ -43,8 +43,8 @@ Test file for the util m5 exit assembly instruction.
 '''
 from testlib import *
 
-test_progs = {
-    'x86': ('hello64-static', 'hello64-dynamic', 'hello32-static'),
+static_progs = {
+    'x86': ('hello64-static', 'hello32-static'),
     'arm': ('hello64-static', 'hello32-static'),
     'alpha': ('hello',),
     'mips': ('hello',),
@@ -52,6 +52,10 @@ test_progs = {
     'sparc': ('hello',)
 }
 
+dynamic_progs = {
+    'x86': ('hello64-dynamic',)
+}
+
 if config.bin_path:
     base_path = config.bin_path
 else:
@@ -59,24 +63,32 @@ else:
         'bin')
 
 urlbase = 'http://dist.gem5.org/dist/current/test-progs/hello/bin/'
-for isa in test_progs:
-    for binary in test_progs[isa]:
-        import os
-        url = urlbase + isa + '/linux/' + binary
-        path = joinpath(base_path, isa, 'linux')
-        hello_program = DownloadedProgram(url, path, binary)
+ref_path = joinpath(getcwd(), 'ref')
+verifiers = (
+        verifier.MatchStdoutNoPerf(joinpath(ref_path, 'simout')),
+)
+
+def verify_config(isa, binary, hosts):
+    url = urlbase + isa + '/linux/' + binary
+    path = joinpath(base_path, isa, 'linux')
+    hello_program = DownloadedProgram(url, path, binary)
 
-        ref_path = joinpath(getcwd(), 'ref')
+    gem5_verify_config(
+            name='test-'+binary,
+            fixtures=(hello_program,),
+            verifiers=verifiers,
+            config=joinpath(config.base_dir, 'configs', 'example','se.py'),
+            config_args=['--cmd', joinpath(path, binary)],
+            valid_isas=(isa.upper(),),
+            valid_hosts=hosts,
+    )
 
-        verifiers = (
-                verifier.MatchStdoutNoPerf(joinpath(ref_path, 'simout')),
-        )
+# Run statically linked hello worlds
+for isa in static_progs:
+    for binary in static_progs[isa]:
+        verify_config(isa, binary, constants.supported_hosts)
 
-        gem5_verify_config(
-                name='test-'+binary,
-                fixtures=(hello_program,),
-                verifiers=verifiers,
-                config=joinpath(config.base_dir, 'configs', 'example','se.py'),
-                config_args=['--cmd', joinpath(path, binary)],
-                valid_isas=(isa.upper(),),
-        )
+# Run dynamically linked hello worlds
+for isa in dynamic_progs:
+    for binary in dynamic_progs[isa]:
+        verify_config(isa, binary, constants.target_host[isa.upper()])