Bobby R. Bruce has submitted this change. (
https://gem5-review.googlesource.com/c/public/gem5/+/44625 )
Change subject: python,tests: Update pyunit tests to run in TestLib
......................................................................
python,tests: Update pyunit tests to run in TestLib
Previously the pyunit tests needed run in the gem5 root, this change
allows them to run as part of the quick TestLib tests (thereby having
them run as part of the presubmit checks). This runs all the TestLib
tests as a single test using the NULL gem5 binary.
`tests/run_pyunit.py` has been updated to only parse files with the
`pyunit` prefix in their filname. As such `pyunit/util/test_convert.py`
has been renamed `pyunit/util/pyunit_convert_check.py`. The word `test`
has been removed entirely as to not clash with the testlib tests as run
by `tests/main.py`.
Example usage:
```
./main.py run --uid
SuiteUID:tests/pyunit/test_run.py:pyunit-tests-NULL-x86_64-opt
```
Discussed briefly in email thread:
https://www.mail-archive.com/[email protected]/msg38563.html
Change-Id: Id566d44fcb5d8c599eb1a90bca56793158a201e6
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/44625
Reviewed-by: Andreas Sandberg <[email protected]>
Maintainer: Bobby R. Bruce <[email protected]>
Tested-by: kokoro <[email protected]>
---
A tests/pyunit/test_run.py
R tests/pyunit/util/pyunit_convert_check.py
M tests/run_pyunit.py
3 files changed, 49 insertions(+), 1 deletion(-)
Approvals:
Andreas Sandberg: Looks good to me, approved
Bobby R. Bruce: Looks good to me, approved
kokoro: Regressions pass
diff --git a/tests/pyunit/test_run.py b/tests/pyunit/test_run.py
new file mode 100644
index 0000000..2accd4c
--- /dev/null
+++ b/tests/pyunit/test_run.py
@@ -0,0 +1,48 @@
+# Copyright (c) 2021 The Regents of the University of California
+# All Rights Reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met: redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer;
+# redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution;
+# neither the name of the copyright holders nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+import os
+
+from testlib.configuration import constants
+from gem5.suite import *
+
+'''
+As the filename begins with `test_`, it will be added to the TestLib
testsuite
+when `../main.py` is run.
+
+The purpose of this file is to ensure the pyunit tests are executed as part
+of a typical TestLib execution. These have been added as part of
the "quick"
+tests and will run with NULL/gem5.*
+'''
+
+gem5_verify_config(
+ name="pyunit-tests",
+ config=os.path.join(os.getcwd(), os.pardir, 'run_pyunit.py'),
+ verifiers=(),
+ config_args=[],
+ valid_isas=(constants.null_tag,),
+ length = constants.quick_tag,
+)
\ No newline at end of file
diff --git a/tests/pyunit/util/test_convert.py
b/tests/pyunit/util/pyunit_convert_check.py
similarity index 100%
rename from tests/pyunit/util/test_convert.py
rename to tests/pyunit/util/pyunit_convert_check.py
diff --git a/tests/run_pyunit.py b/tests/run_pyunit.py
index dcd8984..00f5f9c 100644
--- a/tests/run_pyunit.py
+++ b/tests/run_pyunit.py
@@ -44,7 +44,7 @@
import unittest
loader = unittest.TestLoader()
- tests = loader.discover("pyunit")
+ tests = loader.discover("pyunit", pattern='pyunit*.py')
runner = unittest.runner.TextTestRunner(verbosity=2)
runner.run(tests)
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/44625
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: Id566d44fcb5d8c599eb1a90bca56793158a201e6
Gerrit-Change-Number: 44625
Gerrit-PatchSet: 4
Gerrit-Owner: Bobby R. Bruce <[email protected]>
Gerrit-Reviewer: Andreas Sandberg <[email protected]>
Gerrit-Reviewer: Bobby R. Bruce <[email protected]>
Gerrit-Reviewer: Jason Lowe-Power <[email protected]>
Gerrit-Reviewer: Jason Lowe-Power <[email protected]>
Gerrit-Reviewer: kokoro <[email protected]>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s