From 7fb6db261048116a18a6576a3ff985935c7c6b72 Mon Sep 17 00:00:00 2001 From: Zixian Cai Date: Mon, 20 Nov 2023 17:41:10 +1100 Subject: [PATCH] Update changelog and add unit tests --- docs/src/changelog.md | 9 ++++++--- src/running/config/base/temurin.yml | 4 ++++ tests/test_runtime.py | 29 ++++++++++++++++++++++++++++ tests/test_suite.py | 30 +++++++++++++++++++++++++++++ 4 files changed, 69 insertions(+), 3 deletions(-) create mode 100644 tests/test_runtime.py diff --git a/docs/src/changelog.md b/docs/src/changelog.md index e3add89..3d1f50e 100644 --- a/docs/src/changelog.md +++ b/docs/src/changelog.md @@ -1,17 +1,20 @@ # Changelog ## Unreleased ### Added -#### Benchmark Suites -- `DaCapo`: add 23.11-Chopin release and minheap values. +#### Base Configurations +- DaCapo 23.11-Chopin +- Temurin 21 ### Changed +#### Base Configurations +- Environment variables are expanded when resolving paths of runtimes and benchmark suites. ### Deprecated - Deprecating Python 3.7 support for users. Python 3.7 was last released on June 6, 2023 (3.7.17), which was recent. ### Removed - Dropping Python 3.6 support for users. Last Python 3.6 release was on Sept. 4, 2021 (3.6.15), which was long ago. -- Dropping Python 3.7 support for developers (NOT users). pytest 7.4+ requires at least Python 3.8. +- Dropping Python 3.7 support for developers (NOT users). pytest 7.4+ requires at least Python 3.8 (still supported by Ubuntu 20.04 LTS). ### Fixed diff --git a/src/running/config/base/temurin.yml b/src/running/config/base/temurin.yml index 9d5cc43..e749893 100644 --- a/src/running/config/base/temurin.yml +++ b/src/running/config/base/temurin.yml @@ -11,3 +11,7 @@ runtimes: type: OpenJDK release: 17 home: /usr/lib/jvm/temurin-17-jdk-amd64 + temurin-21: + type: OpenJDK + release: 21 + home: /usr/lib/jvm/temurin-21-jdk-amd64 diff --git a/tests/test_runtime.py b/tests/test_runtime.py new file mode 100644 index 0000000..843359e --- /dev/null +++ b/tests/test_runtime.py @@ -0,0 +1,29 @@ +from running.config import Configuration + + +def test_openjdk_path_ennvvar(): + c = Configuration( + { + "runtimes": { + "temurin-21_bogus": { + "type": "OpenJDK", + "release": 21, + # some bogus environment variable that will not be expanded + "home": "$DAHKDLHDIWHEIUWHEIWEHIJHDJKAGDKJADGUQDGIQUWDGI/temurin-21-jdk-amd64", + }, + "temurin-21": { + "type": "OpenJDK", + "release": 21, + "home": "$HOME/temurin-21-jdk-amd64", + }, + } + } + ) + + c.resolve_class() + temurin_21_bogus = c.get("runtimes")["temurin-21_bogus"] + temurin_21 = c.get("runtimes")["temurin-21_bogus"] + assert "$HOME" not in str(temurin_21.home) + assert "$DAHKDLHDIWHEIUWHEIWEHIJHDJKAGDKJADGUQDGIQUWDGI" in str( + temurin_21_bogus.home + ) diff --git a/tests/test_suite.py b/tests/test_suite.py index f5c2215..0105cd9 100644 --- a/tests/test_suite.py +++ b/tests/test_suite.py @@ -116,3 +116,33 @@ def test_dacapo_openjdk_9_workaround(): print(fop_jdk11.to_string(jdk11)) assert "add-exports" not in fop_jdk8.to_string(jdk8) assert "add-exports" in fop_jdk11.to_string(jdk11) + + +def test_dacapo_path_ennvvar(): + c = Configuration( + { + "suites": { + "dacapo2006_bogus": { + "type": "DaCapo", + "release": "2006", + # some bogus environment variable that will not be expanded + "path": "$DAHKDLHDIWHEIUWHEIWEHIJHDJKAGDKJADGUQDGIQUWDGI/dacapo-2006-10-MR2.jar", + "timing_iteration": 3, + }, + "dacapo2006": { + "type": "DaCapo", + "release": "2006", + "path": "$HOME/dacapo-2006-10-MR2.jar", + "timing_iteration": 3, + }, + } + } + ) + + c.resolve_class() + dacapo2006 = c.get("suites")["dacapo2006"] + dacapo2006_bogus = c.get("suites")["dacapo2006_bogus"] + assert "$HOME" not in str(dacapo2006.path) + assert "$DAHKDLHDIWHEIUWHEIWEHIJHDJKAGDKJADGUQDGIQUWDGI" in str( + dacapo2006_bogus.path + )