From 60ba7e4ae24572ed01236118561004a4eedb0316 Mon Sep 17 00:00:00 2001 From: Angus Gratton Date: Wed, 11 Nov 2020 10:35:24 +1100 Subject: [PATCH] test_nvs_host: Fail on any non-zero exit code when running external tools Check for != -1 was not picking up Python errors as WEXITSTATUS evaluates to 254 (at least on Linux) --- .../nvs_flash/test_nvs_host/test_nvs.cpp | 62 +++++++++---------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/components/nvs_flash/test_nvs_host/test_nvs.cpp b/components/nvs_flash/test_nvs_host/test_nvs.cpp index 778f05eef7..4749076cb4 100644 --- a/components/nvs_flash/test_nvs_host/test_nvs.cpp +++ b/components/nvs_flash/test_nvs_host/test_nvs.cpp @@ -2633,7 +2633,7 @@ TEST_CASE("check and read data from partition generated via partition generation CHECK(childpid > 0); int status; waitpid(childpid, &status, 0); - CHECK(WEXITSTATUS(status) != -1); + CHECK(WEXITSTATUS(status) == 0); } } @@ -2649,7 +2649,7 @@ TEST_CASE("check and read data from partition generated via partition generation } else { CHECK(childpid > 0); waitpid(childpid, &status, 0); - CHECK(WEXITSTATUS(status) != -1); + CHECK(WEXITSTATUS(status) == 0); } } @@ -2666,7 +2666,7 @@ TEST_CASE("check and read data from partition generated via partition generation } else { CHECK(childpid > 0); waitpid(childpid, &status, 0); - CHECK(WEXITSTATUS(status) != -1); + CHECK(WEXITSTATUS(status) == 0); childpid = fork(); @@ -2684,7 +2684,7 @@ TEST_CASE("check and read data from partition generated via partition generation } else { CHECK(childpid > 0); waitpid(childpid, &status, 0); - CHECK(WEXITSTATUS(status) != -1); + CHECK(WEXITSTATUS(status) == 0); } } @@ -2700,7 +2700,7 @@ TEST_CASE("check and read data from partition generated via partition generation } else { CHECK(childpid > 0); waitpid(childpid, &status, 0); - CHECK(WEXITSTATUS(status) != -1); + CHECK(WEXITSTATUS(status) == 0); } } @@ -2720,7 +2720,7 @@ TEST_CASE("check and read data from partition generated via manufacturing utilit } else { CHECK(childpid > 0); waitpid(childpid, &status, 0); - CHECK(WEXITSTATUS(status) != -1); + CHECK(WEXITSTATUS(status) == 0); childpid = fork(); if (childpid == 0) { @@ -2739,7 +2739,7 @@ TEST_CASE("check and read data from partition generated via manufacturing utilit } else { CHECK(childpid > 0); waitpid(childpid, &status, 0); - CHECK(WEXITSTATUS(status) != -1); + CHECK(WEXITSTATUS(status) == 0); childpid = fork(); if (childpid == 0) { @@ -2755,7 +2755,7 @@ TEST_CASE("check and read data from partition generated via manufacturing utilit } else { CHECK(childpid > 0); waitpid(childpid, &status, 0); - CHECK(WEXITSTATUS(status) != -1); + CHECK(WEXITSTATUS(status) == 0); } @@ -2780,7 +2780,7 @@ TEST_CASE("check and read data from partition generated via manufacturing utilit } else { CHECK(childpid > 0); waitpid(childpid, &status, 0); - CHECK(WEXITSTATUS(status) != -1); + CHECK(WEXITSTATUS(status) == 0); } @@ -2801,7 +2801,7 @@ TEST_CASE("check and read data from partition generated via manufacturing utilit } else { CHECK(childpid > 0); waitpid(childpid, &status, 0); - CHECK(WEXITSTATUS(status) != -1); + CHECK(WEXITSTATUS(status) == 0); childpid = fork(); if (childpid == 0) { @@ -2820,7 +2820,7 @@ TEST_CASE("check and read data from partition generated via manufacturing utilit } else { CHECK(childpid > 0); waitpid(childpid, &status, 0); - CHECK(WEXITSTATUS(status) != -1); + CHECK(WEXITSTATUS(status) == 0); childpid = fork(); if (childpid == 0) { @@ -2836,7 +2836,7 @@ TEST_CASE("check and read data from partition generated via manufacturing utilit } else { CHECK(childpid > 0); waitpid(childpid, &status, 0); - CHECK(WEXITSTATUS(status) != -1); + CHECK(WEXITSTATUS(status) == 0); } @@ -2860,7 +2860,7 @@ TEST_CASE("check and read data from partition generated via manufacturing utilit } else { CHECK(childpid > 0); waitpid(childpid, &status, 0); - CHECK(WEXITSTATUS(status) != -1); + CHECK(WEXITSTATUS(status) == 0); } @@ -3016,7 +3016,7 @@ TEST_CASE("test nvs apis for nvs partition generator utility with encryption ena } else { CHECK(childpid > 0); waitpid(childpid, &status, 0); - CHECK(WEXITSTATUS(status) != -1); + CHECK(WEXITSTATUS(status) == 0); childpid = fork(); @@ -3034,7 +3034,7 @@ TEST_CASE("test nvs apis for nvs partition generator utility with encryption ena } else { CHECK(childpid > 0); waitpid(childpid, &status, 0); - CHECK(WEXITSTATUS(status) != -1); + CHECK(WEXITSTATUS(status) == 0); } } @@ -3056,7 +3056,7 @@ TEST_CASE("test nvs apis for nvs partition generator utility with encryption ena } else { CHECK(childpid > 0); waitpid(childpid, &status, 0); - CHECK(WEXITSTATUS(status) != -1); + CHECK(WEXITSTATUS(status) == 0); } @@ -3105,7 +3105,7 @@ TEST_CASE("test nvs apis for nvs partition generator utility with encryption ena } else { CHECK(childpid > 0); waitpid(childpid, &status, 0); - CHECK(WEXITSTATUS(status) != -1); + CHECK(WEXITSTATUS(status) == 0); childpid = fork(); @@ -3116,7 +3116,7 @@ TEST_CASE("test nvs apis for nvs partition generator utility with encryption ena } else { CHECK(childpid > 0); waitpid(childpid, &status, 0); - CHECK(WEXITSTATUS(status) != -1); + CHECK(WEXITSTATUS(status) == 0); childpid = fork(); if (childpid == 0) { @@ -3133,7 +3133,7 @@ TEST_CASE("test nvs apis for nvs partition generator utility with encryption ena } else { CHECK(childpid > 0); waitpid(childpid, &status, 0); - CHECK(WEXITSTATUS(status) != -1); + CHECK(WEXITSTATUS(status) == 0); } } @@ -3226,7 +3226,7 @@ TEST_CASE("test nvs apis for nvs partition generator utility with encryption ena } else { CHECK(childpid > 0); waitpid(childpid, &status, 0); - CHECK(WEXITSTATUS(status) != -1); + CHECK(WEXITSTATUS(status) == 0); } SpiFlashEmulator emu("../nvs_partition_generator/partition_encrypted_using_keyfile.bin"); @@ -3256,7 +3256,7 @@ TEST_CASE("test nvs apis for nvs partition generator utility with encryption ena } else { CHECK(childpid > 0); waitpid(childpid, &status, 0); - CHECK(WEXITSTATUS(status) != -1); + CHECK(WEXITSTATUS(status) == 0); childpid = fork(); @@ -3267,7 +3267,7 @@ TEST_CASE("test nvs apis for nvs partition generator utility with encryption ena } else { CHECK(childpid > 0); waitpid(childpid, &status, 0); - CHECK(WEXITSTATUS(status) != -1); + CHECK(WEXITSTATUS(status) == 0); } } @@ -3288,7 +3288,7 @@ TEST_CASE("check and read data from partition generated via manufacturing utilit } else { CHECK(childpid > 0); waitpid(childpid, &status, 0); - CHECK(WEXITSTATUS(status) != -1); + CHECK(WEXITSTATUS(status) == 0); childpid = fork(); if (childpid == 0) { @@ -3309,7 +3309,7 @@ TEST_CASE("check and read data from partition generated via manufacturing utilit } else { CHECK(childpid > 0); waitpid(childpid, &status, 0); - CHECK(WEXITSTATUS(status) != -1); + CHECK(WEXITSTATUS(status) == 0); childpid = fork(); if (childpid == 0) { @@ -3327,7 +3327,7 @@ TEST_CASE("check and read data from partition generated via manufacturing utilit } else { CHECK(childpid > 0); waitpid(childpid, &status, 0); - CHECK(WEXITSTATUS(status) != -1); + CHECK(WEXITSTATUS(status) == 0); } @@ -3360,7 +3360,7 @@ TEST_CASE("check and read data from partition generated via manufacturing utilit } else { CHECK(childpid > 0); waitpid(childpid, &status, 0); - CHECK(WEXITSTATUS(status) != -1); + CHECK(WEXITSTATUS(status) == 0); } @@ -3381,7 +3381,7 @@ TEST_CASE("check and read data from partition generated via manufacturing utilit } else { CHECK(childpid > 0); waitpid(childpid, &status, 0); - CHECK(WEXITSTATUS(status) != -1); + CHECK(WEXITSTATUS(status) == 0); childpid = fork(); if (childpid == 0) { @@ -3396,7 +3396,7 @@ TEST_CASE("check and read data from partition generated via manufacturing utilit } else { CHECK(childpid > 0); waitpid(childpid, &status, 0); - CHECK(WEXITSTATUS(status) != -1); + CHECK(WEXITSTATUS(status) == 0); childpid = fork(); if (childpid == 0) { @@ -3417,7 +3417,7 @@ TEST_CASE("check and read data from partition generated via manufacturing utilit } else { CHECK(childpid > 0); waitpid(childpid, &status, 0); - CHECK(WEXITSTATUS(status) != -1); + CHECK(WEXITSTATUS(status) == 0); childpid = fork(); if (childpid == 0) { @@ -3435,7 +3435,7 @@ TEST_CASE("check and read data from partition generated via manufacturing utilit } else { CHECK(childpid > 0); waitpid(childpid, &status, 0); - CHECK(WEXITSTATUS(status) != -1); + CHECK(WEXITSTATUS(status) == 0); } @@ -3480,7 +3480,7 @@ TEST_CASE("check and read data from partition generated via manufacturing utilit } else { CHECK(childpid > 0); waitpid(childpid, &status, 0); - CHECK(WEXITSTATUS(status) != -1); + CHECK(WEXITSTATUS(status) == 0); }