Skip to content

Commit 89b320e

Browse files
committed
add initial scaffold for fast smoke test
Signed-off-by: Jack Luar <[email protected]>
1 parent 7c141df commit 89b320e

File tree

4 files changed

+119
-0
lines changed

4 files changed

+119
-0
lines changed

flow/test/test_fast_autotuner.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/usr/bin/env bash
2+
3+
set -euox pipefail
4+
5+
# run the commands in ORFS root dir
6+
echo "[INFO FLW-0029] Installing dependencies in virtual environment."
7+
cd ../
8+
./tools/AutoTuner/installer.sh
9+
. ./tools/AutoTuner/setup.sh
10+
11+
echo "Running Autotuner fast smoke test"
12+
python3 -m unittest tools.AutoTuner.test.fast_smoke_test.FastSmokeTest.test

flow/test/test_helper.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,13 @@ if [ $ret -eq 0 ] && grep -q 'power:' <(echo $TARGETS); then
7676
$__make power 2>&1 | tee -a "$LOG_FILE"
7777
ret=$(( ret + $? ))
7878
fi
79+
80+
# Fast AT Smoke Tests
81+
if [ "${DESIGN_NAME}" = "gcd" ] && [ "${PLATFORM}" = "asap7" ]; then
82+
echo "Start fast autotuner smoke test"
83+
./test/test_fast_autotuner.sh
84+
ret=$(( ret + $? ))
85+
fi
7986
set -x
8087

8188
# Run Autotuner CI specifically for gcd on selected platforms.
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
#############################################################################
2+
##
3+
## Copyright (c) 2024, Precision Innovations Inc.
4+
## All rights reserved.
5+
##
6+
## BSD 3-Clause License
7+
##
8+
## Redistribution and use in source and binary forms, with or without
9+
## modification, are permitted provided that the following conditions are met:
10+
##
11+
## * Redistributions of source code must retain the above copyright notice, this
12+
## list of conditions and the following disclaimer.
13+
##
14+
## * Redistributions in binary form must reproduce the above copyright notice,
15+
## this list of conditions and the following disclaimer in the documentation
16+
## and/or other materials provided with the distribution.
17+
##
18+
## * Neither the name of the copyright holder nor the names of its
19+
## contributors may be used to endorse or promote products derived from
20+
## this software without specific prior written permission.
21+
##
22+
## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
23+
## AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24+
## IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25+
## ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
26+
## LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27+
## CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28+
## SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
29+
## INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
30+
## CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
31+
## ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32+
## POSSIBILITY OF SUCH DAMAGE.
33+
###############################################################################
34+
35+
import unittest
36+
import subprocess
37+
import os
38+
from .autotuner_test_utils import AutoTunerTestUtils
39+
40+
cur_dir = os.path.dirname(os.path.abspath(__file__))
41+
42+
43+
class FastSmokeTest(unittest.TestCase):
44+
platform = "asap7"
45+
design = "gcd"
46+
47+
def setUp(self):
48+
self.tune_config = os.path.join(
49+
cur_dir,
50+
f"../../../flow/designs/{self.platform}/{self.design}/autotuner.json",
51+
)
52+
self.sweep_config = os.path.join(
53+
cur_dir,
54+
"./files/fast-at-sweep.json",
55+
)
56+
self.exec = AutoTunerTestUtils.get_exec_cmd()
57+
self.tune_command = (
58+
f"{self.exec}"
59+
f" --design {self.design}"
60+
f" --platform {self.platform}"
61+
f" --experiment fast-smoke-test-tune"
62+
f" --config {self.tune_config}"
63+
f" tune --samples 1"
64+
)
65+
self.sweep_command = (
66+
f"{self.exec}"
67+
f" --design {self.design}"
68+
f" --platform {self.platform}"
69+
f" --experiment fast-smke-test-sweep"
70+
f" --config {self.sweep_config}"
71+
f" sweep"
72+
)
73+
74+
def test(self):
75+
if not (self.platform and self.design):
76+
raise unittest.SkipTest("Platform and design have to be defined")
77+
78+
tune_process = subprocess.Popen(self.tune_command, shell=True)
79+
sweep_process = subprocess.Popen(self.sweep_command, shell=True)
80+
81+
tune_returncode = tune_process.wait()
82+
sweep_returncode = sweep_process.wait()
83+
84+
self.assertEqual(tune_returncode, 0, "Tune command failed")
85+
self.assertEqual(sweep_returncode, 0, "Sweep command failed")
86+
87+
88+
89+
if __name__ == "__main__":
90+
unittest.main()
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"CTS_CLUSTER_SIZE": {
3+
"type": "int",
4+
"minmax": [
5+
50,
6+
51
7+
],
8+
"step": 1
9+
}
10+
}

0 commit comments

Comments
 (0)