Skip to content

Commit

Permalink
[ unittest/modelfile ] Add res directory when compiled for android un…
Browse files Browse the repository at this point in the history
…ittest

- In modelfile unittest, some .ini files are formulated temporally at res directory on the fly.
- Previous code did not make res directory, thus fail to write those files.

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

Signed-off-by: skykongkong8 <ss.kong@samsung.com>
  • Loading branch information
skykongkong8 authored and jijoongmoon committed Oct 24, 2024
1 parent 363a419 commit 9813029
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
18 changes: 9 additions & 9 deletions test/unittest/unittest_nntrainer_modelfile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ GTEST_PARAMETER_TEST(
mkIniTc("basic4_p", {nw_base + "loss=cross", adam, input + "-Activation", out+"input_layers=inputlayer" + "-Activation"}, SUCCESS),
mkIniTc("basic5_p", {nw_base_cross, adam, input, out+"input_layers=inputlayer"}, SUCCESS),
mkIniTc("basic6_p", {nw_base_cross, sgd, input, out+"input_layers=inputlayer"}, SUCCESS),
mkIniTc("basic_act_p", {nw_base_cross, sgd, input + "-Activation", act_relu+"input_layers=inputlayer", out+"input_layers=relu" }, SUCCESS),
mkIniTc("basic_act_p", {nw_base_cross, sgd, input + "-Activation", act_relu+"input_layers=inputlayer", out+"input_layers=activation_relu" }, SUCCESS),
// mkIniTc("basic_bn_p", {nw_base_cross, sgd, input + "-Activation", batch_normal+"input_layers=inputlayer", act_relu+"input_layers=bn", out+"input_layers=relu" }, SUCCESS),
// mkIniTc("basic_bn2_p", {nw_base_cross, sgd, input + "-Activation", batch_normal + "Activation = relu"+"input_layers=inputlayer", out+"input_layers=bn" }, SUCCESS),
/**
Expand Down Expand Up @@ -769,16 +769,16 @@ TEST(nntrainerIniTest, backbone_17_p) {
* it should be referred relative to the .ini
* @todo Fail on Android
*/
// TEST(nntrainerIniTest, backbone_from_different_directory_n) {
// ScopedIni b{"base", {nw_base_cross, batch_normal}};
// ScopedIni s{getResPath("original"),
// {nw_base_cross + "loss=mse", adam, input,
// backbone_valid + "input_layers=inputlayer"}};
TEST(nntrainerIniTest, backbone_from_different_directory_n) {
ScopedIni b{"base", {nw_base_cross, batch_normal}};
ScopedIni s{getResPath("original"),
{nw_base_cross + "loss=mse", adam, input,
backbone_valid + "input_layers=inputlayer"}};

// nntrainer::NeuralNetwork NN;
nntrainer::NeuralNetwork NN;

// EXPECT_EQ(NN.loadFromConfig(s.getIniName()), ML_ERROR_INVALID_PARAMETER);
// }
EXPECT_EQ(NN.loadFromConfig(s.getIniName()), ML_ERROR_INVALID_PARAMETER);
}

/**
* @brief backbone is at different directory, if working directory is not set,
Expand Down
2 changes: 1 addition & 1 deletion tools/android_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ if [ $? != 0 ]; then
exit 1
fi

adb shell mkdir -p /data/local/tmp/nntr_android_test
adb shell mkdir -p /data/local/tmp/nntr_android_test/res

adb push . /data/local/tmp/nntr_android_test

Expand Down

0 comments on commit 9813029

Please sign in to comment.