[Doc] Add documentation of using test-devel
authorJihoon Lee <jhoon.it.lee@samsung.com>
Thu, 11 Mar 2021 09:44:24 +0000 (18:44 +0900)
committerMyungJoo Ham <myungjoo.ham@samsung.com>
Tue, 16 Mar 2021 04:58:29 +0000 (13:58 +0900)
Add documentation of how to utilize test-devel package in the
perspective of subplugin developer

**Self evaluation:**
1. Build test: [ ]Passed [ ]Failed [X]Skipped
2. Run test: [ ]Passed [ ]Failed [X]Skipped

Signed-off-by: Jihoon Lee <jhoon.it.lee@samsung.com>
Documentation/writing-subplugin-tensor-filter.md
debian/control

index fbfdb72..15333e7 100644 (file)
@@ -63,12 +63,49 @@ As you can see in packaging/*.spec and meson.build of the template, ```nnstreame
 
 In order to provide callbacks required by ```tensor_filter```, you need to include ```nnstreamer_plugin_api_filter.h```, which is supplied with ```nnstreamer-dev``` package (in Tizen or Ubuntu).
 
+### Testing
 
-### Install Path
+There is a templated test suite provided inside `nnstreamer-test-dev` package for dpkg, `nnstreamer-test-devel` for tizen distro.
+You may install or _BuildRequire_ this package to utilize predefined test templates.
+After installing the package, you can locate the package.
 
-The default ```tensor_filter``` subplugin path is ```/usr/lib/nnstreamer/filters/```. It can be modified by configuring ```/etc/nnstreamer.ini```.
 
+```sh
+$ TEMPLATE_DIR=$(pkg-config nnstreamer --variable=test_templatedir)
+$ echo $TEMPLATE_DIR # result varies depending on the platform
+/usr/lib/nnstreamer/bin/unittest-nnstreamer
+$ ls $TEMPLATE_DIR
+nnstreamer-test.ini.in  subplugin_unittest_template.cc.in
+```
+
+There are two test template provided. One is conf file for the test enviornment, and the other is for the basic unittests (requires gtest).
+
+List of variables that needs to be provided are provided below...
+| File                              | Variables                                                                                                                            |
+| --------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------ |
+| nnstreamer-test.ini.in            | SUBPLUGIN_INSTALL_PREFIX, ENABLE_ENV_VAR, ENABLE_SYMBOLIC_LINK, TORCH_USE_GPU, TFLITE_SUBPLUGIN_PRIORITY, ELEMENT_RESTRICTION_CONFIG |
+| subplugin_unittest_template.cc.in | EXT_NAME, EXT_ABBRV, MODEL_FILE,                                                                                                     |
+
+You can change the provided each variable on the go using a script, for example...
+```sh
+$ sed s/@EXT_ABBRV@/cutom_plugin/g subplugin_unittest_template.cc.in > subplugin_unittest.cc
+```
+
+but preferably, using meson through `configure_data` and `configure_file`
 
+and defining `NNSTREAMER_CONF_PATH` environment variable will locate the `nnstreamer-test.ini` to find your subplugin
+
+with generated `nnstreamer-test.ini`
+
+You can run the test as below:
+
+```sh
+NNSTREMAER_CONF_PATH=your/conf/file.ini ./subplugin_unittest
+```
+
+### Install Path
+
+The default ```tensor_filter``` subplugin path is ```/usr/lib/nnstreamer/filters/```. It can be modified by configuring ```/etc/nnstreamer.ini```.
 ### Flexible/Dynamic Input/Output Tensor Dimension
 
 Although the given template code supports static input/output tensor dimension (a single neural network model is supposed to have a single set of input/output tensor/tensors dimensions), NNStreamer's ```tensor_filter``` itself supports dynamic input/output tensor/tensors dimensions; output dimensions may be determined by input dimensions, which is determined at run-time.
index b59b9e9..86cc572 100644 (file)
@@ -127,10 +127,10 @@ Description: Development package to access internal functions of NNStreamer.
 Package: nnstreamer-test-dev
 Architecture: any
 Multi-Arch: same
-Depends: nnstreamer, ${shlibs:Depends}, ${misc:Depends}
-Description: NNStreamer development package
Gstreamer plugins, "NNStreamer", provides access to neural network frameworks for media streams.
This is development package for nnstreamer.
+Depends: nnstreamer-dev, ${shlibs:Depends}, ${misc:Depends}
+Description: Development package to provide testable environment of a subplugin (tensor_filter/custom).
This package enables testable environment of NNStreamer sub-plugin by making nnstreamer to recognize NNSTREAMER_CONF_PATH to steer a sub-plugin path to a custom path.
Also This package provides test templates to be used with.
 
 Package: nnstreamer-util
 Architecture: any