Thread (20 messages) flat view 20 messages, 4 authors, 2021-08-18

Re: [PATCH v4 1/6] t6030-bisect-porcelain: add tests to control bisect run exit cases

From: Miriam R. <hidden>
Date: 2021-08-17 20:22:01

Hi,

El mar, 17 ago 2021 a las 11:23, Christian Couder
([off-list ref]) escribió:
On Tue, Aug 17, 2021 at 11:03 AM Bagas Sanjaya [off-list ref] wrote:
quoted
On 17/08/21 15.14, Miriam Rubio wrote:
quoted
+test_expect_success 'bisect run fails with exit code equals or greater than 128' '
+     write_script test_script.sh <<-\EOF &&
+     exit 128 >/dev/null
+     EOF
+     test_must_fail git bisect run ./test_script.sh > my_bisect_log.txt
+'
This only checks for exit code equals to 128. You should also check for
exit code greater than 128, for example 255.
Noted.
Thank you for reviewing, Bagas.
quoted
quoted
+
+test_expect_success 'bisect run fails with exit code smaller than 0' '
+     write_script test_script.sh <<-\EOF &&
+     exit -1 >/dev/null
+     EOF
+     test_must_fail git bisect run ./test_script.sh > my_bisect_log.txt
+'
This test looks OK, using -1 as representative of negative exit code.
However, wording of test name can also be 'bisect run fails with
negative exit code'.
Actually I am not sure that it makes sense to test an exit code
smaller than 0, as POSIX exit codes are between 0 and 255 (included).

For example:

$ bash -c 'exit -1'; echo $?
255

$ dash -c 'exit -1'; echo $?
dash: 1: exit: Illegal number: -1
2
Ok, I will remove this test. No problem.
Thanks, Christian.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help