diff --git a/tests/t/22qconstr-uplink.t b/tests/t/22qconstr-uplink.t index 1f2aa1b..e752aa9 100644 --- a/tests/t/22qconstr-uplink.t +++ b/tests/t/22qconstr-uplink.t @@ -3,14 +3,16 @@ # use Test; -BEGIN { plan tests => 2 + 5 + 2 + 2 + 2 }; +BEGIN { plan tests => 2 + 6 + 2 + 3 + 2 }; use runproduct; use istest; use Ham::APRS::IS; use Ham::APRS::IS_Fake; ok(1); # If we made it this far, we're ok. -my $iss1 = new Ham::APRS::IS_Fake('127.0.0.1:54153', 'CORE1'); +my $upstream_call = 'FAKEUP'; + +my $iss1 = new Ham::APRS::IS_Fake('127.0.0.1:54153', $upstream_call); ok(defined $iss1, 1, "Test failed to initialize listening server socket (IPv4)"); $iss1->bind_and_listen(); @@ -28,11 +30,7 @@ ok(defined $i_rx, 1, "Failed to initialize Ham::APRS::IS"); my $is1 = $iss1->accept(); ok(defined $is1, (1), "Failed to accept connection 1 from server"); - -#warn "sending login prompt\n"; -$iss1->send_login_prompt($is1); -#warn "sending login ok\n"; -$iss1->send_login_ok($is1); +ok($iss1->process_login($is1), 'ok', "Failed to accept login 1 from server"); my $ret; $ret = $i_rx->connect('retryuntil' => 8); @@ -57,14 +55,14 @@ ok($ret, 1, "Failed to connect to the server: " . $i_rx->{'error'}); # (2): istest::txrx(\&ok, $is1, $i_rx, "SRC>DST,DIGI1,DIGI2*,qAI,FOOBA,BLAA:testing qAI (1)", - "SRC>DST,DIGI1,DIGI2*,qAI,FOOBA,BLAA,7F000001,$server_call:testing qAI (1)"); + "SRC>DST,DIGI1,DIGI2*,qAI,FOOBA,BLAA,$upstream_call,$server_call:testing qAI (1)"); # unbind the IPv4 server and create IPv6 server $iss1->unbind(); #warn "switching to ipv6\n"; -my $iss6 = new Ham::APRS::IS_Fake('[::1]:54153', 'CORE6'); +my $iss6 = new Ham::APRS::IS_Fake('[::1]:54153', $upstream_call); ok(defined $iss6, 1, "Test failed to initialize listening server socket on IPv6"); $iss6->bind_and_listen(); @@ -76,13 +74,12 @@ $is1->disconnect(); my $is6 = $iss6->accept(); ok(defined $is6, (1), "Failed to accept connection ipv6 from server"); -$iss6->send_login_prompt($is6); -$iss6->send_login_ok($is6); +ok($iss6->process_login($is6), 'ok', "Failed to accept login ipv6 from server"); # (2), ipv6: istest::txrx(\&ok, $is6, $i_rx, "SRC>DST,DIGI1,DIGI2*,qAI,FOOBAR,BLAA:testing qAI (ipv6)", - "SRC>DST,DIGI1,DIGI2*,qAI,FOOBAR,BLAA,00000000000000000000000000000001,$server_call:testing qAI (ipv6)"); + "SRC>DST,DIGI1,DIGI2*,qAI,FOOBAR,BLAA,$upstream_call,$server_call:testing qAI (ipv6)"); # disconnect $ret = $i_rx->disconnect(); diff --git a/tests/t/23qconstr-long.t b/tests/t/23qconstr-long.t index 69070c9..02a2f96 100644 --- a/tests/t/23qconstr-long.t +++ b/tests/t/23qconstr-long.t @@ -24,7 +24,7 @@ BEGIN { if ($append) { push @l, "D" x $append; } elsif (@l) { - $l[$#l] .= '*'; + $l[$#l] =~ s/(.)$/,Y/; } #warn join(',', @l) . "\n"; my $packet = "SRC>DST,qAI," . join(',', @l) . ":$data"; @@ -33,12 +33,12 @@ BEGIN { push @packets, $packet; } - plan tests => 6 + ($#packets+1) + 5; + plan tests => 7 + ($#packets+1) + 5; }; ok(1); # If we made it this far, we're ok. -my $iss6 = new Ham::APRS::IS_Fake('[::1]:54153', 'CORE6'); +my $iss6 = new Ham::APRS::IS_Fake('[::1]:54153', 'FAKEIS'); ok(defined $iss6, 1, "Test failed to initialize listening server socket on IPv6"); $iss6->bind_and_listen(); @@ -54,9 +54,7 @@ ok(defined $i_rx, 1, "Failed to initialize Ham::APRS::IS"); my $is6 = $iss6->accept(); ok(defined $is6, (1), "Failed to accept connection ipv6 from server"); -$iss6->send_login_prompt($is6); -my $log2 = $is6->getline_noncomment(1); -$iss6->send_login_ok($is6); +ok($iss6->process_login($is6), 'ok', "Failed to accept login ipv6 from server"); my $ret; $ret = $i_rx->connect('retryuntil' => 8); @@ -65,11 +63,12 @@ ok($ret, 1, "Failed to connect to the server: " . $i_rx->{'error'}); # do the actual tests my $maxlen = 509; -$maxlen = 510 if ($ENV{'TEST_PRODUCT'} eq 'javap'); +$maxlen = 510 if (defined $ENV{'TEST_PRODUCT'} && $ENV{'TEST_PRODUCT'} =~ /^javap/); foreach my $packet (@packets) { my $expect = $packet; - $expect =~ s/:/,00000000000000000000000000000001,$server_call:/; + $expect =~ s/:/,FAKEIS,$server_call:/; + #warn "tx: $packet\n"; if (length($expect) > $maxlen) { $is6->sendline($packet); ok(1); diff --git a/tests/t/27digipath-long.t b/tests/t/27digipath-long.t index 30e3a19..d1964b6 100644 --- a/tests/t/27digipath-long.t +++ b/tests/t/27digipath-long.t @@ -33,16 +33,16 @@ BEGIN { push @packets, $packet; } - plan tests => 8 + ($#packets+1) + 2 + 2; + plan tests => 9 + ($#packets+1) + 2 + 2; }; ok(1); # If we made it this far, we're ok. -my $iss1 = new Ham::APRS::IS_Fake('127.0.0.1:54153', 'CORE1'); +my $iss1 = new Ham::APRS::IS_Fake('127.0.0.1:54153', 'FAKE4'); ok(defined $iss1, 1, "Test failed to initialize listening server socket"); $iss1->bind_and_listen(); -my $iss6 = new Ham::APRS::IS_Fake('[::1]:54153', 'CORE6'); +my $iss6 = new Ham::APRS::IS_Fake('[::1]:54153', 'FAKE6'); ok(defined $iss6, 1, "Test failed to initialize listening server socket on IPv6"); $iss6->bind_and_listen(); @@ -56,17 +56,9 @@ my $server_call = "TESTING"; my $i_rx = new Ham::APRS::IS("localhost:55152", $login); ok(defined $i_rx, 1, "Failed to initialize Ham::APRS::IS"); -#my $is1 = $iss1->accept(); -#ok(defined $is1, (1), "Failed to accept connection 1 from server"); -#$iss1->send_login_prompt($is1); -#my $log1 = $is1->getline_noncomment(1); -#$iss1->send_login_ok($is1); - my $is6 = $iss6->accept(); ok(defined $is6, (1), "Failed to accept connection ipv6 from server"); -$iss6->send_login_prompt($is6); -my $log2 = $is6->getline_noncomment(1); -$iss6->send_login_ok($is6); +ok($iss6->process_login($is6), 'ok', "Failed to accept login ipv6 from server"); my $ret; $ret = $i_rx->connect('retryuntil' => 8); @@ -75,12 +67,12 @@ ok($ret, 1, "Failed to connect to the server: " . $i_rx->{'error'}); # do the actual tests my $maxlen = 509; -$maxlen = 510 if ($ENV{'TEST_PRODUCT'} eq 'javap'); +$maxlen = 510 if (defined $ENV{'TEST_PRODUCT'} && $ENV{'TEST_PRODUCT'} =~ /^javap/); # (1): foreach my $packet (@packets) { my $expect = $packet; - $expect =~ s/IGATE:/IGATE,00000000000000000000000000000001,$server_call:/; + $expect =~ s/IGATE:/IGATE,FAKE6,$server_call:/; if (length($expect) > $maxlen) { my $res = $is6->sendline($packet); if ($res) {