From 20aba1ab8499736f945d1db7d220c39a777d373f Mon Sep 17 00:00:00 2001 From: Eryk Szpotanski Date: Mon, 21 Oct 2024 15:44:15 +0200 Subject: [PATCH] tools: Autotuner: Add smoke test for Vizier Signed-off-by: Eryk Szpotanski --- flow/test/test_helper.sh | 3 ++ tools/AutoTuner/test/smoke_test_vizier.py | 52 +++++++++++++++++++++++ 2 files changed, 55 insertions(+) create mode 100644 tools/AutoTuner/test/smoke_test_vizier.py diff --git a/flow/test/test_helper.sh b/flow/test/test_helper.sh index 9b2409d114..b0c0338c97 100755 --- a/flow/test/test_helper.sh +++ b/flow/test/test_helper.sh @@ -98,6 +98,9 @@ if [[ -n "${RUN_AUTOTUNER+x}" ]] && [[ ${RUN_AUTOTUNER} -eq 1 ]]; then echo "Running Autotuner smoke tests for --sample and --iteration." python3 -m unittest tools.AutoTuner.test.smoke_test_sample_iteration.${PLATFORM}SampleIterationSmokeTest.test_sample_iteration + echo "Running Autotuner smoke Vizier test" + python3 -m unittest tools.AutoTuner.test.smoke_test_vizier.${PLATFORM}VizierSmokeTest.test_vizier + if [ "$PLATFORM" == "asap7" ] && [ "$DESIGN" == "gcd" ]; then echo "Running Autotuner ref file test (only once)" python3 -m unittest tools.AutoTuner.test.ref_file_check.RefFileCheck.test_files diff --git a/tools/AutoTuner/test/smoke_test_vizier.py b/tools/AutoTuner/test/smoke_test_vizier.py new file mode 100644 index 0000000000..648d2229d4 --- /dev/null +++ b/tools/AutoTuner/test/smoke_test_vizier.py @@ -0,0 +1,52 @@ +import unittest +import subprocess +import os +from datetime import datetime + +cur_dir = os.path.dirname(os.path.abspath(__file__)) + + +class BaseVizierSmokeTest(unittest.TestCase): + platform = "" + design = "" + + def setUp(self): + self.config = os.path.join( + cur_dir, + f"../../../flow/designs/{self.platform}/{self.design}/autotuner.json", + ) + self.experiment = f"smoke-test-tune-{self.platform}-{datetime.now().strftime('%Y-%m-%d-%H-%M-%S')}" + self.command = ( + "python3 -m autotuner.vizier" + f" --design {self.design}" + f" --platform {self.platform}" + f" --experiment {self.experiment}" + f" --config {self.config}" + f" --iteration 1 --suggestions 1" + ) + + def test_vizier(self): + if not (self.platform and self.design): + raise unittest.SkipTest("Platform and design have to be defined") + out = subprocess.run(self.command, shell=True, check=True) + successful = out.returncode == 0 + self.assertTrue(successful) + + +class ASAP7VizierSmokeTest(BaseVizierSmokeTest): + platform = "asap7" + design = "gcd" + + +class SKY130HDVizierSmokeTest(BaseVizierSmokeTest): + platform = "sky130hd" + design = "gcd" + + +class IHPSG13G2VizierSmokeTest(BaseVizierSmokeTest): + platform = "ihp-sg13g2" + design = "gcd" + + +if __name__ == "__main__": + unittest.main()