github action: add tests of valgrind, gtest, ssat.
authorMyungJoo Ham <myungjoo.ham@samsung.com>
Fri, 22 Apr 2022 07:57:15 +0000 (16:57 +0900)
committerSangjung Woo <again4you@gmail.com>
Fri, 15 Dec 2023 06:28:15 +0000 (15:28 +0900)
Add test runs for github-action - Ubuntu clean build.
However, do not block PRs for valgrind errors until
we get most valgrind errors fixed.

Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
.github/workflows/ubuntu_clean_meson_build.yml
packaging/run_unittests_binaries.sh

index 1f2b317..4462d4f 100644 (file)
@@ -1,4 +1,4 @@
-name: Minimal meson build in Ubuntu
+name: Minimal meson build in Ubuntu with Valgrind
 
 on:
   pull_request:
@@ -18,10 +18,13 @@ jobs:
       with:
         python-version: '3.x'
     - name: install minimal requirements
-      run: |
-          sudo apt-get update && \
-          sudo apt-get install -y libglib2.0-dev libjson-glib-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libunwind-dev googletest \
-            gstreamer1.0-plugins-good
+      run: sudo apt-get update && sudo apt-get install -y libglib2.0-dev libjson-glib-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libunwind-dev googletest
+    - name: install additional packages for features
+      run: sudo apt-get install -y liborc-0.4-dev flex bison libopencv-dev pkg-config python3-dev python3-numpy python3
+    - name: install additional package from PPA for testing
+      run: sudo add-apt-repository -y ppa:nnstreamer/ppa && sudo apt-get update && sudo apt-get install -y ssat libpaho-mqtt-dev
+    - name: install additional package from Ubuntu for testing and valgrind
+      run: sudo apt-get install -y valgrind gstreamer1.0-tools gstreamer1.0-plugins-good gstreamer1.0-plugins-base libgtest-dev libpng-dev libc6-dbg binutils-x86-64-linux-gnu-dbg valgrind-dbg
     - run: pip install meson ninja
     - run: meson setup build/
       env:
@@ -33,6 +36,10 @@ jobs:
       with:
         name: Meson_Testlog
         path: build/meson-logs/testlog.txt
+    - name: SSAT run with Valgrind on decoder-bounding-box
+      run: if [ '${{ matrix.os }}' == 'ubuntu-22.04' ]; then export NNSTREAMER_BUILD_ROOT_PATH=`pwd`/build && export NNSTREAMER_FILTERS=`pwd`/build/ext/nnstreamer/tensor_filter && export NNSTREAMER_DECODERS=`pwd`/build/ext/nnstreamer/tensor_decoder && export NNSTREAMER_CONVERTERS=`pwd`/build/ext/nnstreamer/tensor_converter && export GST_PLUGIN_PATH=`pwd`/build/gst && export NNSTREAMER_CONF=`pwd`/build/nnstreamer-test.ini && pushd tests/nnstreamer_decoder_boundingbox && G_SLICE=always-malloc G_DEBUG=gc-friendly ssat -n -p=1 --enable-valgrind --summary summary.txt -cn _n && popd; fi
+    - name: GTEST run with Valgrind on a case
+      run: if [ '${{ matrix.os }}' == 'ubuntu-22.04' ]; then export NNSTREAMER_BUILD_ROOT_PATH=`pwd`/build && export NNSTREAMER_FILTERS=`pwd`/build/ext/nnstreamer/tensor_filter && export NNSTREAMER_DECODERS=`pwd`/build/ext/nnstreamer/tensor_decoder && export NNSTREAMER_CONVERTERS=`pwd`/build/ext/nnstreamer/tensor_converter && export GST_PLUGIN_PATH=`pwd`/build/gst && export NNSTREAMER_CONF=`pwd`/build/nnstreamer-test.ini && G_SLICE=always-malloc G_DEBUG=gc-friendly ./packaging/run_unittests_binaries.sh --valgrind ./tests/ || echo "There are Valgrind errors. Please fix it. As we have a lot of Valgrind errors from different libraries and possible from nnstreamer itself, we are not halting the build with Valgrind errors until we get them all."; fi
 
 # TODO: add more subplugins to be built
 # TODO: add unit testing
index e388f46..e1c6f54 100755 (executable)
@@ -10,6 +10,7 @@
 input=""
 skip_tests=""
 this_script="$(basename -- $0)"
+VALGRIND=""
 while (( "$#" )); do
   case "$1" in
     -k|--skip)
@@ -28,6 +29,10 @@ while (( "$#" )); do
       echo "        Skip the test cases whose names are...(valid only if target is a directory)" >&2
       exit 0
       ;;
+    --valgrind)
+      VALGRIND="valgrind"
+      shift 1
+      ;;
     -*|--*)
       echo "$1: invalid option" >&2
       exit 1
@@ -69,7 +74,12 @@ run_entry() {
     popd
   fi
 
-  ${entry} --gtest_output="xml:${entry##*/}.xml"
+  if [[ "$VALGRIND" == "valgrind" ]]; then
+    valgrind -v --tool=memcheck --leak-check=full --num-callers=40 --error-exitcode=-1 ${entry} --gtest_output="xml:${entry##*/}.xml"
+  else
+    ${entry} --gtest_output="xml:${entry##*/}.xml"
+  fi
+
   retval=$?
   export PYTHONPATH=${_PYTHONPATH}