[test] Fix snpe filter test to support two API versions
authorYongjoo Ahn <yongjoo1.ahn@samsung.com>
Mon, 15 Jan 2024 07:51:39 +0000 (16:51 +0900)
committerMyungJoo Ham <myungjoo.ham@samsung.com>
Thu, 1 Feb 2024 01:16:54 +0000 (10:16 +0900)
- Add dlc model files for SNPE2.
- Rename SNPE1 model files.
- Fix unittest to set proper model files.

Signed-off-by: Yongjoo Ahn <yongjoo1.ahn@samsung.com>
tests/nnstreamer_filter_snpe/unittest_filter_snpe.cc
tests/test_models/models/add2_float.v1.dlc [moved from tests/test_models/models/add2_float.dlc with 100% similarity]
tests/test_models/models/add2_float.v2.dlc [new file with mode: 0644]
tests/test_models/models/add2_uint8.v1.dlc [moved from tests/test_models/models/add2_uint8.dlc with 100% similarity]
tests/test_models/models/add2_uint8.v2.dlc [new file with mode: 0644]

index 10e35c0..aaf4abb 100644 (file)
@@ -25,7 +25,13 @@ _GetModelFilePath (gchar **model_file, gboolean is_float_model)
 {
   const gchar *src_root = g_getenv ("NNSTREAMER_SOURCE_ROOT_PATH");
   gchar *root_path = src_root ? g_strdup (src_root) : g_get_current_dir ();
-  std::string model_name = is_float_model ? "add2_float.dlc" : "add2_uint8.dlc";
+#if SNPE_VERSION_MAJOR == 1
+  std::string model_name = is_float_model ? "add2_float.v1.dlc" : "add2_uint8.v1.dlc";
+#elif SNPE_VERSION_MAJOR == 2
+  std::string model_name = is_float_model ? "add2_float.v2.dlc" : "add2_uint8.v2.dlc";
+#else
+#error "Unsupported SNPE version"
+#endif
 
   *model_file = g_build_filename (
       root_path, "tests", "test_models", "models", model_name.c_str (), NULL);
diff --git a/tests/test_models/models/add2_float.v2.dlc b/tests/test_models/models/add2_float.v2.dlc
new file mode 100644 (file)
index 0000000..f5b9151
Binary files /dev/null and b/tests/test_models/models/add2_float.v2.dlc differ
diff --git a/tests/test_models/models/add2_uint8.v2.dlc b/tests/test_models/models/add2_uint8.v2.dlc
new file mode 100644 (file)
index 0000000..6227a47
Binary files /dev/null and b/tests/test_models/models/add2_uint8.v2.dlc differ