tests: Standardized test resources download dir
authorBobby R. Bruce <bbruce@ucdavis.edu>
Fri, 21 Aug 2020 00:41:24 +0000 (17:41 -0700)
committerBobby R. Bruce <bbruce@ucdavis.edu>
Fri, 4 Sep 2020 20:10:45 +0000 (20:10 +0000)
We were downloading resources to various different locations, for no
real reason. This standardizes the process. From this commit onwards,
all testing resources are downloaded to `tests/gem5/resources` by
default. This may be overriden via the `--bin-path` TestLib argument.

Note: In order to do this I have changed the meaning of the `bin-path`
TestLib argument slightly. Previously the `bin-path` assumed a flat
(non-existant) hierarchy. A simple directory of local resources. This
new bin-path functionality maintains logical sub-directories. This is
technically an API change and will be noted in the release notes.

Change-Id: I4df85c121fa65f787fd71f03d74361afea121380
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/33145
Reviewed-by: Hoa Nguyen <hoanguyen@ucdavis.edu>
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Maintainer: Jason Lowe-Power <power.jg@gmail.com>

ext/testlib/configuration.py
tests/.gitignore
tests/gem5/cpu_tests/test.py
tests/gem5/fixture.py
tests/gem5/fs/linux/arm/test.py
tests/gem5/hello_se/test_hello_se.py
tests/gem5/insttest_se/test.py
tests/gem5/m5_util/test_exit.py
tests/gem5/m5threads_test_atomic/test.py

index 4e2b6951d15bec89b11035efe6974c8923994662..48fd2a0754e1744e7e5836d52694a49293588075 100644 (file)
@@ -215,6 +215,10 @@ def define_defaults(defaults):
                                                       os.pardir))
     defaults.result_path = os.path.join(os.getcwd(), '.testing-results')
     defaults.resource_url = 'http://dist.gem5.org/dist/develop'
+    defaults.resource_path = os.path.abspath(os.path.join(defaults.base_dir,
+                                            'tests',
+                                            'gem5',
+                                            'resources'))
 
 def define_constants(constants):
     '''
@@ -569,8 +573,8 @@ def define_common_args(config):
         Argument(
             '--bin-path',
             action='store',
-            default=None,
-            help='Path where binaries are stored (downloaded if not present)'
+            default=config._defaults.resource_path,
+            help='Path where resources are stored (downloaded if not present)'
         ),
         Argument(
             '--resource-url',
index 7c78cf7703a3b40282712a641224ab2ac7436e40..6e620f5d3063fe45789c537e8cc19461da5c8249 100644 (file)
@@ -1,7 +1,2 @@
 .testing-results
-gem5/cpu_tests/benchmarks
-gem5/fs/linux/arm/*.tar.bz2
-gem5/fs/linux/arm/binaries
-gem5/fs/linux/arm/disks
-gem5/test-progs
 gem5/resources
index a21c4b96565c95bdf0dac2281c27d65ddf6a6bdd..44f057489052bd32560ad0adae9a976e6c81d275 100644 (file)
@@ -51,10 +51,7 @@ valid_isas = {
     'riscv': ('AtomicSimpleCPU', 'TimingSimpleCPU', 'MinorCPU', 'DerivO3CPU'),
 }
 
-if config.bin_path:
-    base_path = config.bin_path
-else:
-    base_path = joinpath(absdirpath(__file__), 'benchmarks', 'bin')
+base_path = joinpath(config.bin_path, 'cpu_tests')
 
 base_url = config.resource_url + '/gem5/cpu_tests/benchmarks/bin/'
 for isa in valid_isas:
index fc6aee8f78c243783b4820647a6c5168b3a6b366..94f358134325246a63b0e2290c91416dfbb28fce 100644 (file)
@@ -223,7 +223,7 @@ class MakeTarget(Fixture):
 
 class TestProgram(MakeTarget):
     def __init__(self, program, isa, os, recompile=False):
-        make_dir = joinpath('test-progs', program)
+        make_dir = joinpath(config.bin_dir, program)
         make_fixture = MakeFixture(make_dir)
         target = joinpath('bin', isa, os, program)
         super(TestProgram, self).__init__(target, make_fixture)
index 89e9e65b3b138fa5c2a04ec4e7c23a8772c6665c..80a2af69e9bc775afe765d31a421fe1d89dcc2b5 100644 (file)
@@ -91,7 +91,7 @@ arm_fs_long_tests = [
 tarball = 'aarch-system-201901106.tar.bz2'
 url = config.resource_url + "/arm/" + tarball
 filepath = os.path.dirname(os.path.abspath(__file__))
-path = config.bin_path if config.bin_path else filepath
+path = joinpath(config.bin_path, 'arm')
 arm_fs_binaries = DownloadedArchive(url, path, tarball)
 
 for name in arm_fs_quick_tests:
index c7cf7fe5295d40314e3f07579b2cb3ff561bcbe2..abae3cf10e6c658804dd19695d35177598f66025 100644 (file)
@@ -82,11 +82,7 @@ os_length = {
     'sparc' : constants.long_tag,
 }
 
-if config.bin_path:
-    base_path = config.bin_path
-else:
-    base_path = joinpath(absdirpath(__file__), '..', 'test-progs', 'hello',
-        'bin')
+base_path = joinpath(config.bin_path, 'hello')
 
 urlbase = config.resource_url + '/test-progs/hello/bin/'
 
index 4009d69f05947aabf19e84bcd64c6be679912910..519b349fed16d8089378d53a2d457f4abf4d8642 100644 (file)
@@ -43,10 +43,7 @@ supported_os = {
     'sparc' : ('linux',)
 }
 
-if config.bin_path:
-    base_path = config.bin_path
-else:
-    base_path = joinpath(absdirpath(__file__), '..', 'test-progs')
+base_path = joinpath(config.bin_path, 'insttest')
 
 urlbase = config.resource_url + '/test-progs/insttest/bin/'
 for isa in test_progs:
index 0a0dc1621cb4977f67d44ef5e5844de7032506de..98c3fbd179b4d381e77cc581429c75cd8ded59b9 100644 (file)
@@ -47,11 +47,7 @@ m5_exit_regex = re.compile(
 r'Exiting @ tick \d* because m5_exit instruction encountered'
 )
 
-if config.bin_path:
-    path = config.bin_path
-else:
-    path = joinpath(absdirpath(__file__), '..',
-                    'test-progs', 'hello', 'bin', 'x86', 'linux')
+path = joinpath(config.bin_path, 'test-progs', 'hello', 'bin', 'x86', 'linux')
 filename = 'm5_exit'
 url = (config.resource_url + '/test-progs/m5-exit/bin/x86/linux/m5_exit')
 test_program = DownloadedProgram(url, path, filename)
index 88dafe2d3fa3a57d45109dd80762ba0731ab8e71..6bb4eafa4047d93f8b202ae950b8016471c65526 100644 (file)
@@ -38,11 +38,7 @@ cpu_types = (
     # 'TimingSimpleCPU',
 )
 
-if config.bin_path:
-    base_path = config.bin_path
-else:
-    base_path = joinpath(absdirpath(__file__), '..', 'test-progs',
-                         'test_atomic', 'bin')
+base_path = joinpath(config.bin_path, 'pthreads', 'sparc64')
 
 binary = 'test_atomic'
 url = config.resource_url + '/test-progs/pthreads/sparc64/' + binary