Skip to contentSkip to conversation

rpc: Warn when tests aren't compiled

PATCH New Petr Vorel 2 participants 3 messages May 12, 2020

lore
Share & tools
lore

Petr Vorel

author
#0 lore raw

PATCH 1/1 rpc: Warn when tests aren't compiled

Without this test failure was wrongly reported:
rpc_test 1 TFAIL: tirpc_rpcb_getaddr 10.0.0.2 536875000 failed unexpectedly

---
 testcases/network/rpc/rpc-tirpc/rpc_test.sh | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
testcases/network/rpc/rpc-tirpc/rpc_test.sh +5 -3
index 30cfd2564..fd72e6be4 100755
@@ -35,10 +35,12 @@ EOF
 
 rpc_parse_args()
 {
+	local err="LTP compiled without TI-RPC support"
+
 	case "$1" in
-		c) CLIENT="$OPTARG" ;;
-		e) CLIENT_EXTRA_OPTS="$OPTARG" ;;
-		s) SERVER="$OPTARG" ;;
+	c) CLIENT="$OPTARG"; tst_cmd_available $OPTARG || tst_brk TCONF $err;;
+	e) CLIENT_EXTRA_OPTS="$OPTARG";;
+	s) SERVER="$OPTARG"; tst_cmd_available $OPTARG || tst_brk TCONF $err;;
 	esac
 }
 
Signature · 1 line
2.26.2
#1 lore raw

PATCH 1/1 rpc: Warn when tests aren't compiled

Quoted 3 lines · Petr Vorel

Without this test failure was wrongly reported:
rpc_test 1 TFAIL: tirpc_rpcb_getaddr 10.0.0.2 536875000 failed unexpectedly

Hi Petr,

Quoted 13 lines
---
 testcases/network/rpc/rpc-tirpc/rpc_test.sh | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
testcases/network/rpc/rpc-tirpc/rpc_test.sh +0 -0
index 30cfd2564..fd72e6be4 100755
@@ -35,10 +35,12 @@ EOF
 
 rpc_parse_args()
 {

testcases/network/rpc/rpc-tirpc/rpc_test.sh EOF · line 44

Quoted 10 lines
testcases/network/rpc/rpc-tirpc/rpc_test.sh +5 -3
+	local err="LTP compiled without TI-RPC support"
+
 	case "$1" in
-		c) CLIENT="$OPTARG" ;;
-		e) CLIENT_EXTRA_OPTS="$OPTARG" ;;
-		s) SERVER="$OPTARG" ;;
+	c) CLIENT="$OPTARG"; tst_cmd_available $OPTARG || tst_brk TCONF $err;;
+	e) CLIENT_EXTRA_OPTS="$OPTARG";;
+	s) SERVER="$OPTARG"; tst_cmd_available $OPTARG || tst_brk TCONF $err;;
 	esac

Perhaps this one, to write about the missing command:
tst_require_cmds $CLIENT $SERVER

or just $CLIENT because it's always used, and if the hint is needed:
tst_check_cmds $CLIENT $SERVER || tst_brk TCONF "LTP compiled without TI-RPC support?"

author
#2 lore raw

PATCH 1/1 rpc: Warn when tests aren't compiled

Hi Alexey,

...

Quoted 16 lines

testcases/network/rpc/rpc-tirpc/rpc_test.sh EOF · line 44

Quoted 12 lines

rpc_parse_args()
{

testcases/network/rpc/rpc-tirpc/rpc_test.sh +5 -3
+	local err="LTP compiled without TI-RPC support"
+
 	case "$1" in
-		c) CLIENT="$OPTARG" ;;
-		e) CLIENT_EXTRA_OPTS="$OPTARG" ;;
-		s) SERVER="$OPTARG" ;;
+	c) CLIENT="$OPTARG"; tst_cmd_available $OPTARG || tst_brk TCONF $err;;
+	e) CLIENT_EXTRA_OPTS="$OPTARG";;
+	s) SERVER="$OPTARG"; tst_cmd_available $OPTARG || tst_brk TCONF $err;;
 	esac

Perhaps this one, to write about the missing command:
tst_require_cmds $CLIENT $SERVER

Quoted 2 lines

or just $CLIENT because it's always used, and if the hint is needed:
tst_check_cmds $CLIENT $SERVER || tst_brk TCONF "LTP compiled without TI-RPC support?"

I prefer to have the hint, so I'll merge this variant.

Thanks for your review!

Kind regards,
Petr