1*7b624629SGabriele Monaco#!/bin/bash 2*7b624629SGabriele Monaco# SPDX-License-Identifier: GPL-2.0 3*7b624629SGabriele Monacosource ../tests/engine.sh 4*7b624629SGabriele Monacotest_begin 5*7b624629SGabriele Monaco 6*7b624629SGabriele Monacoset_timeout 30s 7*7b624629SGabriele Monaco 8*7b624629SGabriele Monaco# Help tests 9*7b624629SGabriele Monacocheck "verify kunit subcommand help" \ 10*7b624629SGabriele Monaco "$RVGEN kunit -h" 0 "model_name" "spec" 11*7b624629SGabriele Monaco 12*7b624629SGabriele Monacocheck_and_compare_folder "KUnit generation with local lookup and test_da_kunit" \ 13*7b624629SGabriele Monaco "$RVGEN monitor -c da -s tests/specs/test_da.dot -t per_cpu -n test_da_kunit && $RVGEN kunit -a -l -n test_da_kunit" \ 14*7b624629SGabriele Monaco "test_da_kunit" "Now complete the test and add it to rv_monitors_test.c" "RV_MON_OPS_INIT" 15*7b624629SGabriele Monaco 16*7b624629SGabriele Monacocheck_and_compare_folder "KUnit generation with local lookup and test_ha_kunit" \ 17*7b624629SGabriele Monaco "$RVGEN monitor -c ha -s tests/specs/test_ha.dot -t per_task -n test_ha_kunit && $RVGEN kunit -a -l -n test_ha_kunit" \ 18*7b624629SGabriele Monaco "test_ha_kunit" "Successfully created KUnit" "Append the following to" 19*7b624629SGabriele Monaco 20*7b624629SGabriele Monacocheck_and_compare_folder "KUnit generation with local lookup and test_ltl_kunit" \ 21*7b624629SGabriele Monaco "$RVGEN monitor -c ltl -s tests/specs/test_ltl.ltl -t per_task -n test_ltl_kunit && $RVGEN kunit -l -n test_ltl_kunit" \ 22*7b624629SGabriele Monaco "test_ltl_kunit" "RV_MON_OPS_INIT" 23*7b624629SGabriele Monaco 24*7b624629SGabriele Monacocheck_and_compare_folder "KUnit generation with backup file" \ 25*7b624629SGabriele Monaco "$RVGEN monitor -c ltl -s tests/specs/test_ltl.ltl -t per_task -n test_bak_kunit && echo DUMMY > test_bak_kunit/test_bak_kunit_kunit.c && $RVGEN kunit -l -n test_bak_kunit" \ 26*7b624629SGabriele Monaco "test_bak_kunit" "KUnit file(s) already exist.*backing up existing files" 27*7b624629SGabriele Monaco 28*7b624629SGabriele Monaco# Error handling tests 29*7b624629SGabriele Monacocheck "missing required model_name" \ 30*7b624629SGabriele Monaco "$RVGEN kunit" 2 "the following arguments are required: -n/--model_name" 31*7b624629SGabriele Monaco 32*7b624629SGabriele Monacocheck "non-existent model_name with auto_patch" \ 33*7b624629SGabriele Monaco "$RVGEN kunit -a -n nonexistent" 1 \ 34*7b624629SGabriele Monaco "Could not find monitor C file" "Traceback (most recent call last)" 35*7b624629SGabriele Monaco 36*7b624629SGabriele Monacocheck "monitor without handlers" \ 37*7b624629SGabriele Monaco "mkdir -p nohandler ; echo DUMMY > nohandler/nohandler.c ; $RVGEN kunit -l -n nohandler" 1 \ 38*7b624629SGabriele Monaco "No handlers found" "Traceback (most recent call last)" 39*7b624629SGabriele Monacorm -rf nohandler 40*7b624629SGabriele Monaco 41*7b624629SGabriele Monacotest_end 42