From 4aaf6365a55ce89146d7a043f46cfe5719a572c7 Mon Sep 17 00:00:00 2001 From: MyungJoo Ham Date: Thu, 14 Jun 2018 13:38:06 +0900 Subject: [PATCH] [Converter/Filter] Migrate all testcases into the central test mechanism. Move rest of tensor_converter/test/* to tests/nnstreamer_converter Signed-off-by: MyungJoo Ham --- tensor_converter/test/.gitignore | 3 -- tensor_converter/test/runTest.sh | 33 --------------- tensor_converter/test/testcase01.sh | 36 ---------------- tensor_converter/test/testcase02.sh | 49 ---------------------- tensor_converter/test/testcase03.sh | 49 ---------------------- tensor_filter/test/nothing | 0 tensor_filter/test/runTest.sh | 22 ---------- tensor_filter/test/testcase01.sh | 32 -------------- .../generateGoldenTestResult.py | 0 tests/nnstreamer_converter/runTest.sh | 11 ++++- 10 files changed, 9 insertions(+), 226 deletions(-) delete mode 100644 tensor_converter/test/.gitignore delete mode 100755 tensor_converter/test/runTest.sh delete mode 100755 tensor_converter/test/testcase01.sh delete mode 100755 tensor_converter/test/testcase02.sh delete mode 100755 tensor_converter/test/testcase03.sh delete mode 100644 tensor_filter/test/nothing delete mode 100755 tensor_filter/test/runTest.sh delete mode 100755 tensor_filter/test/testcase01.sh rename {tensor_converter/test => tests/nnstreamer_converter}/generateGoldenTestResult.py (100%) diff --git a/tensor_converter/test/.gitignore b/tensor_converter/test/.gitignore deleted file mode 100644 index 90e6bcf..0000000 --- a/tensor_converter/test/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -*.log -*.golden -*.png diff --git a/tensor_converter/test/runTest.sh b/tensor_converter/test/runTest.sh deleted file mode 100755 index a20a630..0000000 --- a/tensor_converter/test/runTest.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/usr/bin/env bash - -failed=0 -sopath="" - -if [ "$1" == "-skipgen" ] -then - echo "Test Case Generation Skipped" - sopath=$2 -else - python generateGoldenTestResult.py - sopath=$1 -fi -./testcase01.sh $sopath || failed=1 -./testcase02.sh $sopath || failed=1 -./testcase03.sh $sopath || failed=1 - - -echo "" -echo "" -echo "==================================================" -echo " Test for tensor_converter" -echo "==================================================" -if [ "$failed" -eq "0" ] -then - echo SUCCESS - echo "" - exit 0 -else - echo FAILED - echo "" - exit -1 -fi diff --git a/tensor_converter/test/testcase01.sh b/tensor_converter/test/testcase01.sh deleted file mode 100755 index 0c507bc..0000000 --- a/tensor_converter/test/testcase01.sh +++ /dev/null @@ -1,36 +0,0 @@ -#!/usr/bin/env bash - -## -# Copyright (C) 2018 Samsung Electronics -# License: Apache-2.0 -# -# @file testcase01.sh -# @brief Test tensor_converter for testcase 01 -# @author MyungJoo Ham -# @dependency cmp - -if [ $# -eq 0 ] -then - PATH_TO_PLUGIN="$PWD/../../build/tensor_converter" -else - PATH_TO_PLUGIN="$1" -fi - -failed=0 - -# Generate one frame only (num-buffers=1) - -gst-launch-1.0 --gst-plugin-path=${PATH_TO_PLUGIN} videotestsrc num-buffers=1 ! video/x-raw,format=RGB,width=280,height=40,framerate=0/1 ! tee name=t ! queue ! videoconvert ! video/x-raw, format=BGRx ! tensor_converter ! filesink location="test.bgrx.log" sync=true t. ! queue ! filesink location="test.rgb.log" sync=true || failed=1 - -# Check the results (test.rgb.log, test.bgrx.log) -cmp -n `stat --printf="%s" testcase01.bgrx.golden` test.bgrx.log testcase01.bgrx.golden || failed=1 -cmp -n `stat --printf="%s" testcase01.rgb.golden` test.rgb.log testcase01.rgb.golden || failed=1 - -if [ "$failed" -eq "0" ] -then - echo Testcase 01: SUCCESS - exit 0 -else - echo Testcase 01: FAILED - exit -1 -fi diff --git a/tensor_converter/test/testcase02.sh b/tensor_converter/test/testcase02.sh deleted file mode 100755 index 64e9fd6..0000000 --- a/tensor_converter/test/testcase02.sh +++ /dev/null @@ -1,49 +0,0 @@ -#!/usr/bin/env bash - -## -# Copyright (C) 2018 Samsung Electronics -# License: Apache-2.0 -# -# @file testcase02.sh -# @brief Test tensor_converter for testcase 02 -# @author MyungJoo Ham -# @dependency cmp - -if [ $# -eq 0 ] -then - PATH_TO_PLUGIN="$PWD/../../build/tensor_converter" -else - PATH_TO_PLUGIN="$1" -fi - -failed=0 - -# Generate one frame only (num-buffers=1) -do_test() -{ - echo - echo "Case 2 - $1 $2 x $3" - echo - echo gst-launch-1.0 -q --gst-plugin-path=${PATH_TO_PLUGIN} filesrc location=testcase02_${1}_${2}x${3}.png ! pngdec ! videoscale ! imagefreeze ! videoconvert ! video/x-raw,format=${1},width=${2},height=${3},framerate=0/1 ! tensor_converter ! filesink location="testcase02_${1}_${2}x${3}.log" sync=true - gst-launch-1.0 --gst-plugin-path=${PATH_TO_PLUGIN} filesrc location=testcase02_${1}_${2}x${3}.png ! pngdec ! videoscale ! imagefreeze ! videoconvert ! video/x-raw,format=${1},width=${2},height=${3},framerate=0/1 ! tensor_converter ! filesink location="testcase02_${1}_${2}x${3}.log" sync=true || failed=1 - - if [ "$failed" -eq "1" ] - then - echo gst-launch failed - fi - cmp -n `stat --printf="%s" testcase02_${1}_${2}x${3}.golden` testcase02_${1}_${2}x${3}.log testcase02_${1}_${2}x${3}.golden || failed=1 -} - -do_test BGRx 640 480 -do_test RGB 640 480 -do_test BGRx 642 480 -do_test RGB 642 480 - -if [ "$failed" -eq "0" ] -then - echo Testcase 02: SUCCESS - exit 0 -else - echo Testcase 02: FAILED - exit -1 -fi diff --git a/tensor_converter/test/testcase03.sh b/tensor_converter/test/testcase03.sh deleted file mode 100755 index 4cad247..0000000 --- a/tensor_converter/test/testcase03.sh +++ /dev/null @@ -1,49 +0,0 @@ -#!/usr/bin/env bash - -## -# Copyright (C) 2018 Samsung Electronics -# License: Apache-2.0 -# -# @file testcase03.sh -# @brief Test tensor_converter for testcase 03. disabling in-place mode -# @author MyungJoo Ham -# @dependency cmp - -if [ $# -eq 0 ] -then - PATH_TO_PLUGIN="$PWD/../../build/tensor_converter" -else - PATH_TO_PLUGIN="$1" -fi - -failed=0 - -# Generate one frame only (num-buffers=1) -do_test() -{ - echo - echo "Case 3 - $1 $2 x $3" - echo - echo gst-launch-1.0 -q --gst-plugin-path=${PATH_TO_PLUGIN} filesrc location=testcase02_${1}_${2}x${3}.png ! pngdec ! videoscale ! imagefreeze ! videoconvert ! video/x-raw,format=${1},width=${2},height=${3},framerate=0/1 ! tensor_converter force_memcpy=TRUE ! filesink location="testcase02_${1}_${2}x${3}.log" sync=true - gst-launch-1.0 --gst-plugin-path=${PATH_TO_PLUGIN} filesrc location=testcase02_${1}_${2}x${3}.png ! pngdec ! videoscale ! imagefreeze ! videoconvert ! video/x-raw,format=${1},width=${2},height=${3},framerate=0/1 ! tensor_converter force_memcpy=TRUE ! filesink location="testcase03_${1}_${2}x${3}.log" sync=true || failed=1 - - if [ "$failed" -eq "1" ] - then - echo gst-launch failed - fi - cmp -n `stat --printf="%s" testcase02_${1}_${2}x${3}.golden` testcase03_${1}_${2}x${3}.log testcase02_${1}_${2}x${3}.golden || failed=1 -} - -do_test BGRx 640 480 -do_test RGB 640 480 -do_test BGRx 642 480 -do_test RGB 642 480 - -if [ "$failed" -eq "0" ] -then - echo Testcase 03: SUCCESS - exit 0 -else - echo Testcase 03: FAILED - exit -1 -fi diff --git a/tensor_filter/test/nothing b/tensor_filter/test/nothing deleted file mode 100644 index e69de29..0000000 diff --git a/tensor_filter/test/runTest.sh b/tensor_filter/test/runTest.sh deleted file mode 100755 index d5f862a..0000000 --- a/tensor_filter/test/runTest.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/env bash - -failed=0 -sopath="" - -./testcase01.sh $sopath || failed=1 - -echo "" -echo "" -echo "==================================================" -echo " Test for tensor_converter" -echo "==================================================" -if [ "$failed" -eq "0" ] -then - echo SUCCESS - echo "" - exit 0 -else - echo FAILED - echo "" - exit -1 -fi diff --git a/tensor_filter/test/testcase01.sh b/tensor_filter/test/testcase01.sh deleted file mode 100755 index 3cddb4f..0000000 --- a/tensor_filter/test/testcase01.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/usr/bin/env bash - -## -# Copyright (C) 2018 Samsung Electronics -# License: Apache-2.0 -# -# @file testcase01.sh -# @brief Test tensor_converter for testcase 01 -# @author MyungJoo Ham -# @dependency cmp - -if [ $# -eq 0 ] -then - PATH_TO_PLUGIN="$PWD/../../build/tensor_converter:$PWD/../../build/tensor_filter" -else - PATH_TO_PLUGIN="$1" -fi - -failed=0 - -# Generate one frame only (num-buffers=1) - -gst-launch-1.0 -v --gst-debug=GST_CAPS:4 --gst-plugin-path=${PATH_TO_PLUGIN} videotestsrc num-buffers=1 ! video/x-raw,format=RGB,width=280,height=40,framerate=0/1 ! videoconvert ! video/x-raw, format=BGRx ! tensor_converter silent=FALSE ! tensor_filter debug=TRUE framework='tensorflow-lite' model='./nothing' input='4:280:40' inputtype='uint8' output='1' outputtype='uint8' ! filesink location="test.bgrx.log" sync=true || failed=1 - -if [ "$failed" -eq "0" ] -then - echo Testcase 01: SUCCESS - exit 0 -else - echo Testcase 01: FAILED - exit -1 -fi diff --git a/tensor_converter/test/generateGoldenTestResult.py b/tests/nnstreamer_converter/generateGoldenTestResult.py similarity index 100% rename from tensor_converter/test/generateGoldenTestResult.py rename to tests/nnstreamer_converter/generateGoldenTestResult.py diff --git a/tests/nnstreamer_converter/runTest.sh b/tests/nnstreamer_converter/runTest.sh index bdc7cf7..239b573 100755 --- a/tests/nnstreamer_converter/runTest.sh +++ b/tests/nnstreamer_converter/runTest.sh @@ -21,13 +21,20 @@ function do_test { compareAllSizeLimit testcase02_${1}_${2}x${3}.golden testcase02_${1}_${2}x${3}.log ${4} } +function do_test_nonip { + gstTest "--gst-plugin-path=${PATH_TO_PLUGIN} filesrc location=testcase02_${1}_${2}x${3}.png ! pngdec ! videoscale ! imagefreeze ! videoconvert ! video/x-raw,format=${1},width=${2},height=${3},framerate=0/1 ! tensor_converter silent=TRUE force_memcpy=TRUE ! filesink location=\"testcase02_${1}_${2}x${3}.nonip.log\" sync=true" ${4} + + compareAllSizeLimit testcase02_${1}_${2}x${3}.golden testcase02_${1}_${2}x${3}.nonip.log ${4} +} do_test BGRx 640 480 2-1 do_test RGB 640 480 2-2 do_test BGRx 642 480 2-3 do_test RGB 642 480 2-4 -#./testcase02.sh $sopath || failed=1 - +do_test_nonip BGRx 640 480 3-1 +do_test_nonip RGB 640 480 3-2 +do_test_nonip BGRx 642 480 3-3 +do_test_nonip RGB 642 480 3-4 report -- 2.7.4