[CI/Unit test] Integrate unit test with cmake.
authorsewon.oh <sewon.oh@samsung.com>
Wed, 27 Jun 2018 06:48:19 +0000 (15:48 +0900)
committer함명주/동작제어Lab(SR)/Principal Engineer/삼성전자 <myungjoo.ham@samsung.com>
Wed, 27 Jun 2018 11:33:26 +0000 (20:33 +0900)
Test command: ctest -V (you can do after 'make', -V means log output)
- ./CMakeLists.txt: add subdirectory and enable test
- test/CMakeLists.txt: add unit test
- testAll.sh: using `dirname $0` to solve path problem
- testAPI.sh: same as testAll.sh
- debian/control: add dependency for unit testing

Signed-off-by: Sewon Oh <sewon.oh@samsung.com>
CMakeLists.txt
debian/control
tests/CMakeLists.txt [new file with mode: 0644]
tests/testAPI.sh
tests/testAll.sh

index 8ba38c6..b9f0a1d 100644 (file)
@@ -79,6 +79,8 @@ ADD_SUBDIRECTORY(gst/tensor_decoder)
 ADD_SUBDIRECTORY(gst/tensor_sink)
 ADD_SUBDIRECTORY(nnstreamer_example)
 ADD_SUBDIRECTORY(tests/nnstreamer_tensors/tensors_test)
+enable_testing()
+ADD_SUBDIRECTORY(tests)
 
 CONFIGURE_FILE(nnstreamer.pc.in nnstreamer.pc @ONLY)
 
index 7f62812..cdf02d5 100644 (file)
@@ -4,7 +4,9 @@ Priority: optional
 Maintainer: MyungJoo Ham <myungjoo.ham@samsung.com>
 Build-Depends: gcc, cmake, libgstreamer1.0-dev, libgstreamer-plugins-base1.0-dev, libglib2.0-dev,
  libgtest-dev,
- debhelper (>=9)
+ debhelper (>=9),
+ gstreamer1.0-tools, gstreamer1.0-plugins-base, gstreamer1.0-plugins-good,
+ python-pil
 Standards-Version: 3.9.6
 Homepage: https://github.sec.samsung.net/STAR/nnstreamer
 
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
new file mode 100644 (file)
index 0000000..d14cfc7
--- /dev/null
@@ -0,0 +1 @@
+ADD_TEST(unit_test ${CMAKE_CURRENT_SOURCE_DIR}/testAll.sh)
index 995e872..0fc2165 100644 (file)
@@ -1,6 +1,7 @@
 #!/usr/bin/env bash
 if [[ $# -eq 0 ]]; then
-       PATH_TO_PLUGIN="$PWD/../build/gst/tensor_converter:$PWD/../build/gst/tensor_filter:$PWD/../build/gst/tensor_decoder"
+       dirpath="$( cd "$( dirname "$0")" && pwd )"
+       PATH_TO_PLUGIN="$dirpath/../build/gst/tensor_converter:$dirpath/../build/gst/tensor_filter:$dirpath/../build/gst/tensor_decoder"
 else
        PATH_TO_PLUGIN="$1"
 fi
index 1ea2985..e0d3929 100755 (executable)
@@ -1,5 +1,7 @@
 #!/usr/bin/env bash
-source ./testAPI.sh
+dirpath=`dirname $0`
+
+source $dirpath/testAPI.sh
 
 sopath=""
 log=""
@@ -35,7 +37,7 @@ while IFD= read -r -d $'\0' line; do
                summary="${summary}$RED[FAILED] ${PURPLE}$base ${BLUE}(${lsucc} Passed / ${lfail} Failed of ${ltotal} Cases)${NC}\n"
        fi
        popd > /dev/null
-done < <(find . -name "runTest.sh" -print0)
+done < <(find $dirpath -name "runTest.sh" -print0)
 
 printf "\n\n\n"
 printf "$log"