From: Kirill Isakov Date: Fri, 23 Jul 2021 17:14:18 +0000 (+0600) Subject: More strict failure code checks in integration tests. X-Git-Url: https://git.tinc-vpn.org/git/browse?a=commitdiff_plain;h=dfed43f01b69fff92321d1194a6c7c7ba54ca2d0;p=tinc More strict failure code checks in integration tests. --- diff --git a/test/commandline.test b/test/commandline.test index 4bd91f45..ba3d7171 100755 --- a/test/commandline.test +++ b/test/commandline.test @@ -28,9 +28,9 @@ tincd foo -D --net foo echo [STEP] Test tincd command line options that should not work -must_fail tincd foo foo -must_fail tincd foo --pidfile -must_fail tincd foo --foo +expect_code "$EXIT_FAILURE" tincd foo foo +expect_code "$EXIT_FAILURE" tincd foo --pidfile +expect_code "$EXIT_FAILURE" tincd foo --foo echo [STEP] Test tinc command line options that should work @@ -42,10 +42,10 @@ tinc foo --net foo get name echo [STEP] Test tinc command line options that should not work -must_fail tinc foo -n foo get somethingreallyunknown -must_fail tinc foo --net -must_fail tinc foo --net get name -must_fail tinc foo foo +expect_code "$EXIT_FAILURE" tinc foo -n foo get somethingreallyunknown +expect_code "$EXIT_FAILURE" tinc foo --net +expect_code "$EXIT_FAILURE" tinc foo --net get name +expect_code "$EXIT_FAILURE" tinc foo foo # Most of these should fail with ASAN. Some leaks are only detected by Valgrind. echo [STEP] Trigger previously known memory leaks diff --git a/test/compression.test b/test/compression.test index 77efd6d3..0572e48d 100755 --- a/test/compression.test +++ b/test/compression.test @@ -124,7 +124,7 @@ for level in $bogus_levels; do echo "[STEP] Testing bogus compression level $level" tinc foo set Compression "$level" - output=$(must_fail start_tinc foo 2>&1) + output=$(expect_code "$EXIT_FAILURE" start_tinc foo 2>&1) if ! echo "$output" | grep -q 'Bogus compression level'; then bail 'expected message about the wrong compression level' diff --git a/test/variables.test b/test/variables.test index bcec9fb2..e63138f3 100755 --- a/test/variables.test +++ b/test/variables.test @@ -22,7 +22,7 @@ test "$(tinc foo get Mode)" = "Switch" echo [STEP] Test deletion -must_fail tinc foo del Mode hub +expect_code "$EXIT_FAILURE" tinc foo del Mode hub tinc foo del Mode switch test -z "$(tinc foo get Mode)" @@ -52,7 +52,7 @@ test -z "$(tinc foo get Subnet)" echo [STEP] We should not be able to get/set server variables using node.variable syntax test -z "$(tinc foo get foo.Name)" -must_fail tinc foo set foo.Name bar +expect_code "$EXIT_FAILURE" tinc foo set foo.Name bar echo [STEP] Test getting/setting host variables for other nodes @@ -80,11 +80,11 @@ test -z "$(tinc foo get bar.Subnet)" echo [STEP] We should not be able to get/set for nodes with invalid names touch "$DIR_FOO/hosts/qu-ux" -must_fail tinc foo set qu-ux.Subnet 1 +expect_code "$EXIT_FAILURE" tinc foo set qu-ux.Subnet 1 echo [STEP] We should not be able to set obsolete variables unless forced -must_fail tinc foo set PrivateKey 12345 +expect_code "$EXIT_FAILURE" tinc foo set PrivateKey 12345 tinc foo --force set PrivateKey 12345 test "$(tinc foo get PrivateKey)" = "12345"