This commit changes the test directory from ./src/test to ./tests.
Also, this new directory now includes pre-built model binaries.
(e.g., NPU models from NPU_Compiler)
Signed-off-by: Dongju Chae <dongju.chae@samsung.com>
override_dh_auto_test:
# unit tests
- ./build/src/test/unittests/unittest_ne_core_mem
- ./build/src/test/unittests/unittest_ne_core_npu
- ./build/src/test/unittests/unittest_ne_core_gem
- ./build/src/test/unittests/unittest_ne_core_comm_ip
- ./build/src/test/unittests/unittest_ne_core_handler
- ./build/src/test/unittests/unittest_ne_core_inf
- ./build/src/test/unittests/unittest_ne_core_utils
+ ./build/tests/unittests/unittest_ne_core_mem
+ ./build/tests/unittests/unittest_ne_core_npu
+ ./build/tests/unittests/unittest_ne_core_gem
+ ./build/tests/unittests/unittest_ne_core_comm_ip
+ ./build/tests/unittests/unittest_ne_core_handler
+ ./build/tests/unittests/unittest_ne_core_inf
+ ./build/tests/unittests/unittest_ne_core_utils
# app tests
- ./build/src/test/apptests/apptest_dummy_inference
- ./build/src/test/apptests/apptest_dmabuf_model
- ./build/src/test/apptests/apptest_dmabuf_buffers
- ./build/src/test/apptests/apptest_async_callbacks
+ ./build/tests/apptests/apptest_dummy_inference
+ ./build/tests/apptests/apptest_dmabuf_model
+ ./build/tests/apptests/apptest_dmabuf_buffers
+ ./build/tests/apptests/apptest_async_callbacks
# Gen model binaries
# Single-layer test data
find $(CURDIR)/multi -type f -name 'program.*' -delete
# single/multi-layer model test
- ./build/src/test/apptests/apptest_example_visa single > /dev/null
- ./build/src/test/apptests/apptest_example_visa multi > /dev/null
+ ./build/tests/apptests/apptest_example_visa single > /dev/null
+ ./build/tests/apptests/apptest_example_visa multi > /dev/null
override_dh_auto_install:
DESTDIR=$(CURDIR)/debian/tmp ninja -C build install
runNPU_sync(): Execute inference with the registered model in sync mode.
runNPU_async(): Execute inference with the registered model in async mode. Need an output callback.
```
-For complete sample codes, please refer to [here](/src/test/apptests).
+For complete sample codes, please refer to [here](/tests/apptests).
We provide example applications which use the NPU Engline library and its APIs.
They are good reference codes when you develop your applications using the NPU Engine library.
-Please visit [here](/src/test/apptests) to get full source codes.
+Please visit [here](/tests/apptests) to get full source codes.
NPU Engine's two optional packages, `npu-engine-example` and `npu-engine-testdata`, contain test binaries and data, respectively.
You may use them to verify the functionality of NPU Engine and obtain some guides for its usage.
**Ubuntu**: `/opt/trinity/share/npu-engine/testdata`
## Example: apptest_example_visa
-This application ([example_visa.c](/src/test/apptests/example_visa.c)) executes NPU models (with single or multi layers) and compares outputs with their golden data.
+This application ([example_visa.c](/tests/apptests/example_visa.c)) executes NPU models (with single or multi layers) and compares outputs with their golden data.
Note that the testdata used here follows the NPU binary format ([npubinfmt.h](/include/common/npubinfmt.h)) agreed with several parts.
Let's assume you are testing the application in Ubuntu 16.04.
endif
subdir('src')
+subdir('tests')
subdir('tools')
# Set configuration to install .ini
# Perform unit tests
%check
%if 0%{?unit_test}
- pushd build/src
+ pushd build/tests
+
# Run unittests
- find test/unittests -maxdepth 1 -type f -perm 0755 -print0 | while IFS= read -r -d $'\0' unittest_exec; do
+ find unittests -maxdepth 1 -type f -perm 0755 -print0 | while IFS= read -r -d $'\0' unittest_exec; do
%if 0%{?use_valgrind}
valgrind ./${unittest_exec}
%else
%endif
done
# Run apptests
- find test/apptests -maxdepth 1 -type f -perm 0755 -print0 | while IFS= read -r -d $'\0' apptest_exec; do
+ find apptests -maxdepth 1 -type f -perm 0755 -print0 | while IFS= read -r -d $'\0' apptest_exec; do
%if 0%{?use_valgrind}
valgrind ./${apptest_exec}
%else
./${apptest_exec}
%endif
done
- popd
# Run example_visa
%ifarch aarch64 x86_64
- ./build/src/test/apptests/apptest_example_visa %{buildroot}%{testdatadir_out}/single > /dev/null
- ./build/src/test/apptests/apptest_example_visa %{buildroot}%{testdatadir_out}/multi > /dev/null
+ ./apptests/apptest_example_visa %{buildroot}%{testdatadir_out}/single > /dev/null
+ ./apptests/apptest_example_visa %{buildroot}%{testdatadir_out}/multi > /dev/null
%endif
+
+ popd
%endif
# Analyze test coverage
# 'lcov' generates the date format with UTC time zone by default. Let's replace UTC with KST
TZ='Asia/Seoul'; export TZ
- pushd src
-
- ./test/unittestcoverage.py module $(pwd)
+ $(pwd)/tools/unittestcoverage.py module $(pwd)/src
# Get commit info
VCS=`cat ${RPM_SOURCE_DIR}/npu-engine.spec | grep "^VCS:" | sed "s|VCS:\\W*\\(.*\\)|\\1|"`
# Create human readable unit test coverate report web page
-
# Create null gcda files if gcov didn't create it
- find .. -name "*.gcno" -exec sh -c 'touch -a "${1%.gcno}.gcda"' _ {} \;
+ find . -name "*.gcno" -exec sh -c 'touch -a "${1%.gcno}.gcda"' _ {} \;
# Generate report
- lcov -t 'NPU SystemService Unit Test Coverage' -o unittest.info -c -d .. -b $(pwd) --no-external
- # Exclude generated files (Orc)
- lcov -r unittest.info "*/*-orc.*" "*/test/*" -o unittest-filtered.info
+ lcov -t 'NPU SystemService Unit Test Coverage' -o unittest.info -c -d . -b $(pwd)/src --no-external
+ # Exclude generated files
+ lcov -r unittest.info "*/tools/*" "*/tests/*" "*/meson*/*" -o unittest-filtered.info
# Visualize the report
genhtml -o result unittest-filtered.info -t "NPU SystemService %{version}-%{release} ${VCS}" --ignore-errors source -p ${RPM_BUILD_DIR}
+
# Copy unittest results
mkdir -p %{buildroot}%{_datadir}/unittest/
cp -r result %{buildroot}%{_datadir}/unittest/
-
- popd
%endif
%files
dependencies: ne_dependencies,
install : true,
install_dir : ne_libdir)
-
-# Build tests
-subdir('test')
#include <string.h>
#include <pthread.h>
-#include "../ne_test_utils.h"
-#include "../../core/ne-conf.h"
+#include <ne_test_utils.h>
+
+#include "../../src/core/ne-conf.h"
/** @brief lock for private data */
#define TEST_LOCK() pthread_mutex_lock(&priv.mutex)
#include <libnpuhost.h>
#include <npubinfmt.h>
+#include <ne_test_utils.h>
-#include "../ne_test_utils.h"
-#include "../../core/ne-conf.h"
+#include "../../src/core/ne-conf.h"
/** @brief compare output result with the golden data */
static int
#include <libnpuhost.h>
#include <npubinfmt.h>
+#include <ne_test_utils.h>
-#include "../ne_test_utils.h"
-#include "../../core/ne-conf.h"
+#include "../../src/core/ne-conf.h"
/** @brief compare output result with the golden data */
static int
#include <libnpuhost.h>
#include <npubinfmt.h>
-
-#include "../ne_test_utils.h"
+#include <ne_test_utils.h>
/** @brief compare output result with the golden data */
static int
#include <libnpuhost.h>
#include <npubinfmt.h>
-
-#include "../ne_test_utils.h"
+#include <ne_test_utils.h>
/** @brief compare output result with the golden data */
static int
#include <libnpuhost.h>
#include <npubinfmt.h>
-
-#include "../ne_test_utils.h"
+#include <ne_test_utils.h>
#define MAX_FILE_LEN 256
--- /dev/null
+subdir('utils')
+subdir('unittests')
+subdir('apptests')
--- /dev/null
+## tvn models from [NPU_Compiler](https://github.sec.samsung.net/AIP/NPU_Compiler)
+
+```
+Generated by ./NPU_Compiler/tools/vcc/tests/explain.sh
+
+NAME SUMMARY
+000 Identity
+001 MaxPool
+NET_0000 MaxPool-MaxPool
+NET_0001 Placeholder-MaxPool-Conv2D-FakeQuant
+NET_0002 Placeholder-MaxPool--Conv2D------------Add-FakeQuant
+NET_0003 Convolution with excessive memory requirement (over 1MB)
+NET_0004 Padded Conv-BiasAdd-Relu with excessive memory requirement (over 1MB)
+NET_0005 First residual block of RefineDet from Pad-MaxPool split to merge of Add-Relu
+NET_0006 First two residual blocks of RefineDet
+NET_0008 MaxPool-MaxPool network with large(1x40x20x512) input
+NET_0009 MaxPool network with large(1x320x320x64) input
+NET_0011 First Conv2DBackpropInput with constant network for input_sizes
+UNI_CONV_000 Conv-FakeQuantWithMinMaxVars
+UNI_CONV_001 Conv2D-BiasAdd
+UNI_CONV_002 Conv2D-BiasAdd-Relu
+UNI_CONV_003 Conv2D-FakeQuantWithMinMaxVars with non-zero weight
+UNI_CONV_004 Pad-Conv2D-BiasAdd-Relu-FakeQuantiWithMinMaxVars with non-zero weight
+UNI_CONV_005 Conv OFM is not a multiple of 64
+UNI_CONVE_000 Conv2D-BiasAdd-Add-Relu
+UNI_MAXP_000 MaxPool
+UNI_MAXP_001 Pad-MaxPool
+UNI_MAXP_002 Small MaxPool (input 2x2x64, filter 2x2, output 1x1x64)
+UNI_TCNV_000 Conv2DBackpropInput
+UNI_TCNV_001 Conv2DBackpropInput + BiasAdd
+```
{
#include <libnpuhost.h>
#include <npubinfmt.h>
- #include "../ne_test_utils.h"
+ #include <ne_test_utils.h>
}
enum LOCAL_CONSTANTS {
# Build library
+ne_test_utils_inc = include_directories('.')
ne_test_utils_src = ['ne_test_utils.c']
ne_test_utils_dep = declare_dependency(
sources : ne_test_utils_src,
+ include_directories : ne_test_utils_inc,
)
-
-subdir('unittests')
-subdir('apptests')