From 1376264fa211946e083ca520e5b1eb77680ed665 Mon Sep 17 00:00:00 2001 From: Sahil Siddiq Date: Thu, 29 Aug 2024 00:22:06 +0530 Subject: [PATCH] tests: Add rx/simple test case for aborted call Add a test case to rx/simple-t to cover the scenario where the server aborts the call. To cause an abort, send a message with simple-client that is longer than MAX_SIZE. Change-Id: I77a3c74352e7e0226666454ca0646f2419469ab8 Reviewed-on: https://gerrit.openafs.org/15844 Tested-by: BuildBot Reviewed-by: Sahil Siddiq Reviewed-by: Cheyenne Wills Reviewed-by: Michael Meffie Tested-by: Michael Meffie --- tests/rx/simple-t | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/tests/rx/simple-t b/tests/rx/simple-t index 11f7edb428..acd5ef8195 100755 --- a/tests/rx/simple-t +++ b/tests/rx/simple-t @@ -28,7 +28,7 @@ use warnings; use lib $ENV{C_TAP_SOURCE} . "/tests-lib/perl5"; use afstest qw(obj_path); -use Test::More tests=>4; +use Test::More tests=>6; use POSIX qw(:sys_wait_h :signal_h); my $port = 4000; @@ -62,6 +62,18 @@ chomp($got); is(0, $?, "Client ran successfully"); is($expected, $got, "Rot13 performed successfully"); +# Test a case where the server aborts the call +$message = 'This exceeds the message size'; +$got = qx($client localhost $port $service "$message" 2>&1); +$expected = "simple-client: rx_Read failed +simple-client: call aborted with code 201 +"; +my $got_ret = ($? >> 8); +my $expected_ret = 201; + +is($expected_ret, $got_ret, "Client exited with correct status"); +is($got, $expected, "Client saw an aborted call"); + # Kill the server process kill("TERM", $server_pid);