Skip to content

Commit 6ddc1fd

Browse files
etterlirswarbrick
authored andcommitted
[otbn,smoke] Make smoke test independent of REPO_TOP
This makes the OTBN smoke test script independent of the REPO_TOP environment variable. This is helpful when one has multiple clones of the OpenTitan repo. Signed-off-by: Pascal Etterli <pascal.etterli@lowrisc.org>
1 parent a393439 commit 6ddc1fd

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

hw/ip/otbn/dv/smoke/run_smoke.sh

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,24 +15,26 @@ set -o pipefail
1515
set -e
1616

1717
SCRIPT_DIR="$(dirname "$(readlink -e "${BASH_SOURCE[0]}")")"
18-
UTIL_DIR="$(readlink -e "$SCRIPT_DIR/../../../../../util")" || \
18+
ROOT_DIR="$(readlink -e "$SCRIPT_DIR/../../../../..")" || \
19+
fail "Can't find OpenTitan root dir"
20+
UTIL_DIR="$(readlink -e "$ROOT_DIR/util")" || \
1921
fail "Can't find OpenTitan util dir"
2022

2123
source "$UTIL_DIR/build_consts.sh"
2224

2325
SMOKE_BIN_DIR=$BIN_DIR/otbn/smoke_test
24-
SMOKE_SRC_DIR=$REPO_TOP/hw/ip/otbn/dv/smoke
26+
SMOKE_SRC_DIR=$ROOT_DIR/hw/ip/otbn/dv/smoke
2527

2628
mkdir -p $SMOKE_BIN_DIR
2729

28-
OTBN_UTIL=$REPO_TOP/hw/ip/otbn/util
30+
OTBN_UTIL=$ROOT_DIR/hw/ip/otbn/util
2931

3032
$OTBN_UTIL/otbn_as.py -o $SMOKE_BIN_DIR/smoke_test.o $SMOKE_SRC_DIR/smoke_test.s || \
3133
fail "Failed to assemble smoke_test.s"
3234
$OTBN_UTIL/otbn_ld.py -o $SMOKE_BIN_DIR/smoke.elf $SMOKE_BIN_DIR/smoke_test.o || \
3335
fail "Failed to link smoke_test.o"
3436

35-
(cd $REPO_TOP;
37+
(cd $ROOT_DIR;
3638
fusesoc --cores-root=. run --target=sim --setup --build \
3739
--mapping=lowrisc:prim_generic:all:0.1 lowrisc:ip:otbn_top_sim \
3840
--make_options="-j$(nproc)" || fail "HW Sim build failed")
@@ -43,7 +45,7 @@ readonly RUN_LOG
4345
trap "rm -rf $RUN_LOG" EXIT
4446

4547
timeout 5s \
46-
$REPO_TOP/build/lowrisc_ip_otbn_top_sim_0.1/sim-verilator/Votbn_top_sim \
48+
$ROOT_DIR/build/lowrisc_ip_otbn_top_sim_0.1/sim-verilator/Votbn_top_sim \
4749
--load-elf=$SMOKE_BIN_DIR/smoke.elf -t | tee $RUN_LOG
4850

4951
if [ $? -eq 124 ]; then

0 commit comments

Comments
 (0)