Bobby R. Bruce has uploaded this change for review. (
https://gem5-review.googlesource.com/c/public/gem5/+/33145 )
Change subject: tests: Standardized test resources download dir
......................................................................
tests: Standardized test resources download dir
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
---
M ext/testlib/configuration.py
M tests/.gitignore
M tests/gem5/cpu_tests/test.py
M tests/gem5/fixture.py
M tests/gem5/fs/linux/arm/test.py
M tests/gem5/hello_se/test_hello_se.py
M tests/gem5/insttest_se/test.py
M tests/gem5/m5_util/test_exit.py
M tests/gem5/m5threads_test_atomic/test.py
9 files changed, 12 insertions(+), 32 deletions(-)
diff --git a/ext/testlib/configuration.py b/ext/testlib/configuration.py
index 4e2b695..23af707 100644
--- a/ext/testlib/configuration.py
+++ b/ext/testlib/configuration.py
@@ -215,6 +215,9 @@
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,
+ 'gem5',
+ 'resources'))
def define_constants(constants):
'''
@@ -569,8 +572,8 @@
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',
diff --git a/tests/.gitignore b/tests/.gitignore
index 7c78cf7..6e620f5 100644
--- a/tests/.gitignore
+++ b/tests/.gitignore
@@ -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
diff --git a/tests/gem5/cpu_tests/test.py b/tests/gem5/cpu_tests/test.py
index a21c4b9..44f0574 100644
--- a/tests/gem5/cpu_tests/test.py
+++ b/tests/gem5/cpu_tests/test.py
@@ -51,10 +51,7 @@
'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:
diff --git a/tests/gem5/fixture.py b/tests/gem5/fixture.py
index fc6aee8..94f3581 100644
--- a/tests/gem5/fixture.py
+++ b/tests/gem5/fixture.py
@@ -223,7 +223,7 @@
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)
diff --git a/tests/gem5/fs/linux/arm/test.py
b/tests/gem5/fs/linux/arm/test.py
index 1da2207..0cff4f6 100644
--- a/tests/gem5/fs/linux/arm/test.py
+++ b/tests/gem5/fs/linux/arm/test.py
@@ -85,7 +85,7 @@
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:
diff --git a/tests/gem5/hello_se/test_hello_se.py
b/tests/gem5/hello_se/test_hello_se.py
index c7cf7fe..abae3cf 100644
--- a/tests/gem5/hello_se/test_hello_se.py
+++ b/tests/gem5/hello_se/test_hello_se.py
@@ -82,11 +82,7 @@
'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/'
diff --git a/tests/gem5/insttest_se/test.py b/tests/gem5/insttest_se/test.py
index aedbb5d..6d90124 100644
--- a/tests/gem5/insttest_se/test.py
+++ b/tests/gem5/insttest_se/test.py
@@ -51,10 +51,7 @@
'riscv' : ('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:
diff --git a/tests/gem5/m5_util/test_exit.py
b/tests/gem5/m5_util/test_exit.py
index 0a0dc16..98c3fbd 100644
--- a/tests/gem5/m5_util/test_exit.py
+++ b/tests/gem5/m5_util/test_exit.py
@@ -47,11 +47,7 @@
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)
diff --git a/tests/gem5/m5threads_test_atomic/test.py
b/tests/gem5/m5threads_test_atomic/test.py
index 88dafe2..6bb4eaf 100644
--- a/tests/gem5/m5threads_test_atomic/test.py
+++ b/tests/gem5/m5threads_test_atomic/test.py
@@ -38,11 +38,7 @@
# '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
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/33145
To unsubscribe, or for help writing mail filters, visit
https://gem5-review.googlesource.com/settings
Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: I4df85c121fa65f787fd71f03d74361afea121380
Gerrit-Change-Number: 33145
Gerrit-PatchSet: 1
Gerrit-Owner: Bobby R. Bruce <[email protected]>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s