Re: [PATCH 2/6] t1406: prepare for the refs code to fail with BUG()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Am 30.04.2018 um 00:17 schrieb Johannes Schindelin:
t1406 specifically verifies that certain code paths fail with a BUG: ...
message.

In the upcoming commit, we will convert that message to be generated via
BUG() instead of die("BUG: ..."), which implies SIGABRT instead of a
regular exit code.

Signed-off-by: Johannes Schindelin <johannes.schindelin@xxxxxx>
---
  t/t1406-submodule-ref-store.sh | 15 +++++++++------
  1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/t/t1406-submodule-ref-store.sh b/t/t1406-submodule-ref-store.sh
index e093782cc37..0ea3457cae3 100755
--- a/t/t1406-submodule-ref-store.sh
+++ b/t/t1406-submodule-ref-store.sh
@@ -16,7 +16,7 @@ test_expect_success 'setup' '
  '
test_expect_success 'pack_refs() not allowed' '
-	test_must_fail $RUN pack-refs 3
+	test_must_fail ok=sigabrt $RUN pack-refs 3
  '
test_expect_success 'peel_ref(new-tag)' '
@@ -27,15 +27,18 @@ test_expect_success 'peel_ref(new-tag)' '
  '
test_expect_success 'create_symref() not allowed' '
-	test_must_fail $RUN create-symref FOO refs/heads/master nothing
+	test_must_fail ok=sigabrt \
+		$RUN create-symref FOO refs/heads/master nothing
  '
test_expect_success 'delete_refs() not allowed' '
-	test_must_fail $RUN delete-refs 0 nothing FOO refs/tags/new-tag
+	test_must_fail ok=sigabrt \
+		$RUN delete-refs 0 nothing FOO refs/tags/new-tag
  '
test_expect_success 'rename_refs() not allowed' '
-	test_must_fail $RUN rename-ref refs/heads/master refs/heads/new-master
+	test_must_fail ok=sigabrt \
+		$RUN rename-ref refs/heads/master refs/heads/new-master
  '
test_expect_success 'for_each_ref(refs/heads/)' '
@@ -91,11 +94,11 @@ test_expect_success 'reflog_exists(HEAD)' '
  '
test_expect_success 'delete_reflog() not allowed' '
-	test_must_fail $RUN delete-reflog HEAD
+	test_must_fail ok=sigabrt $RUN delete-reflog HEAD
  '
test_expect_success 'create-reflog() not allowed' '
-	test_must_fail $RUN create-reflog HEAD 1
+	test_must_fail ok=sigabrt $RUN create-reflog HEAD 1
  '

I can't quite follow the rationale for this change. A 'BUG' error exit must never be reached, otherwise it is a bug in the program by definition. It cannot be OK that SIGABRT is a valid result from Git.

If SIGABRT occurs as a result of BUG(), and we know that this happens for certain cases, it means we have an unfixed bug. Should then not run these cases under test_expect_failure instead of test_expect_success to identify them as known bugs?

Confused.

-- Hannes



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux