Skip to content

Commit

Permalink
[onert/test] Revise run_test.sh (Samsung#10529)
Browse files Browse the repository at this point in the history
This commit updates run_test.sh script.
- Update help message
- Remove unused function
- Simplify default test driver setting

ONE-DCO-1.0-Signed-off-by: Hyeongseok Oh <[email protected]>
  • Loading branch information
hseok-oh authored Mar 17, 2023
1 parent f5ed2f6 commit 02166b5
Showing 1 changed file with 8 additions and 38 deletions.
46 changes: 8 additions & 38 deletions tests/scripts/models/run_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,44 +29,18 @@ function command_exists() {

function Usage()
{
echo "Usage: ./$0 --driverbin={such as tflite_run} {tests to test or empty for all of tests}"
echo "Usage: ./$0 --driverbin=Product/out/bin/tflite_run --reportdir=report --tapname=verification.tap avgpool1 avgpool2"
echo "Usage: ${BASH_SOURCE[0]} [OPTIONS] {tests to test or empty for all of tests}"
echo "(Ex) : ${BASH_SOURCE[0]} --driverbin=Product/out/bin/onert_run --reportdir=report --tapname=verification.tap avgpool1 avgpool2"
echo ""
echo "--driverbin - (default=../../Product/out/bin/tflite_run) Runner for runnning model tests"
echo "--reportdir - (default=report) Directory to place tap files"
echo "--tapname - (default=framework_test.tap) File name to be written for tap"
echo "--configdir - (default=$TEST_ROOT_PATH) Config directory to download and test model"
echo "--cachedir - (default=$CACHE_ROOT_PATH) Directory to download model"
echo "--driverbin : Runner for runnning model tests"
echo "--reportdir : (default=$REPORT_DIR) Directory to place tap files"
echo "--tapname : (default=$TAP_NAME) File name to be written for tap"
echo "--configdir : (default=$TEST_ROOT_PATH) Config directory to download and test model"
echo "--cachedir : (default=$CACHE_ROOT_PATH) Directory to download model"
echo ""
}

function need_download()
{
LOCAL_PATH=$1
REMOTE_URL=$2
if [ ! -e $LOCAL_PATH ]; then
return 0;
fi
# Ignore checking md5 in cache
# TODO Use "--md5" option only and remove IGNORE_MD5 environment variable
if [ ! -z $IGNORE_MD5 ] && [ "$IGNORE_MD5" == "1" ]; then
return 1
fi
if [ "$MD5_CHECK" = "off" ]; then
return 1
fi

LOCAL_HASH=$(md5sum $LOCAL_PATH | awk '{ print $1 }')
REMOTE_HASH=$(curl --netrc-optional -kLsS $REMOTE_URL | md5sum | awk '{ print $1 }')
# TODO Emit an error when Content-MD5 field was not found. (Server configuration issue)
if [ "$LOCAL_HASH" != "$REMOTE_HASH" ]; then
echo "Downloaded file is outdated or incomplete."
return 0
fi
return 1
}

DRIVER_BIN=""
DRIVER_BIN="$NNFW_HOME/Product/out/bin/onert_run"
TAP_NAME="framework_test.tap"
TEST_LIST=()

Expand Down Expand Up @@ -106,10 +80,6 @@ if [[ ${#TEST_LIST[@]} -eq 0 ]]; then
RUN_DISABLED="false"
fi

if [ ! -n "$DRIVER_BIN" ]; then
DRIVER_BIN="$NNFW_HOME/Product/out/bin/tflite_run"
fi

if [ ! -d "$TEST_ROOT_PATH" ]; then
echo "Cannot find config directory for test: please set proper configdir"
exit 1
Expand Down

0 comments on commit 02166b5

Please sign in to comment.