From ea2fc2d273011bfe3d8be4fea0187f04ca6e3fa4 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Mon, 29 Jul 2024 13:20:24 +0100 Subject: [PATCH] tests/test-ext2-exportname.sh: Ignore libnbd < 1.8 for this test This test attempted to detect a case that happens in libnbd 1.6.2 where an error was reported but the nbdinfo tool still exited with EXIT_SUCCESS. However this test was wrong and a recent change to libnbd caused it to fail visibly. The test was wrong because it checked the return code from cat ($?) rather than the saved return code from nbdinfo ($st). libnbd commit 474a4ae6c8 ("lib: Don't overwrite error in nbd_opt_{go,info}") changed the error message so "server replied with error" no longer appears, which visibly broke this test. I chose to get rid of the incorrect test case and just skip this entire test on libnbd < 1.8. (This skips the test on RHEL 8.) libnbd 1.8 was released over 3 years ago. (cherry picked from commit a67a2e1abdbde218bbaf8fca13dd62ac424e1155) --- tests/test-ext2-exportname.sh | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/tests/test-ext2-exportname.sh b/tests/test-ext2-exportname.sh index d32f07eb..ebfda13f 100755 --- a/tests/test-ext2-exportname.sh +++ b/tests/test-ext2-exportname.sh @@ -39,8 +39,11 @@ requires_nbdinfo requires_nbdsh_uri requires nbdsh -c 'print(h.set_full_info)' +# nbdinfo 1.6.2 accidentally reported an error but had status 0 +requires_libnbd_version 1.8 + sock=$(mktemp -u /tmp/nbdkit-test-sock.XXXXXX) -files="$sock ext2-exportname.pid ext2-exportname.out ext2-exportname.err" +files="$sock ext2-exportname.pid ext2-exportname.out" rm -f $files cleanup_fn rm -f $files @@ -61,16 +64,6 @@ cat ext2-exportname.out grep disk.img ext2-exportname.out grep 'content.*MBR' ext2-exportname.out -# nbdinfo 1.6.2 accidentally reported an error but had status 0 -st=0 -nbdinfo nbd+unix://?socket=$sock > ext2-exportname.out \ - 2> ext2-exportname.err || st=$? -cat ext2-exportname.out ext2-exportname.err -if test $? = 0 && ! grep "server replied with error" ext2-exportname.err; then - echo "unexpected success" - exit 1 -fi - # Test that there is no export list advertised nbdinfo --list --json nbd+unix://?socket=$sock > ext2-exportname.out cat ext2-exportname.out -- 2.47.1