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 <buildbot@rampaginggeek.com>
Reviewed-by: Sahil Siddiq <sahilcdq@proton.me>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Tested-by: Michael Meffie <mmeffie@sinenomine.net>
This commit is contained in:
Sahil Siddiq 2024-08-29 00:22:06 +05:30 committed by Andrew Deason
parent 266ee3a1fe
commit 1376264fa2

View File

@ -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);