1From 829302792bf0e4935d29efc23ca1f2e9e7ee7dfd Mon Sep 17 00:00:00 2001 2From: Jackie Huang <jackie.huang@windriver.com> 3Date: Thu, 7 Jan 2016 03:12:38 -0500 4Subject: [PATCH] test.pl: adjust for ptest 5 6* Don't use interactive inputs, set default test 7 settings instead. 8* Change the test results output to the ptest format 9 10Upstream-Status: Inappropriate [OE ptest specific] 11 12Signed-off-by: Jackie Huang <jackie.huang@windriver.com> 13--- 14 test.pl | 31 ++++++++++++++++++------------- 15 1 file changed, 18 insertions(+), 13 deletions(-) 16 17diff --git a/test.pl b/test.pl 18index cfd1c1e..9b4f10e 100644 19--- a/test.pl 20+++ b/test.pl 21@@ -7,11 +7,11 @@ 22 # Change 1..1 below to 1..last_test_to_print . 23 # (It may become useful if the test is moved to ./t subdirectory.) 24 25-BEGIN {print "1..5\n";} 26-END {print "not ok 1\n" unless $loaded;} 27+BEGIN {print "Start testing for libauthen-radius-perl\n";} 28+END {print "\nFAIL: test1\n" unless $loaded;} 29 use Authen::Radius; 30 $loaded = 1; 31-print "ok 1\n"; 32+print "\nPASS: test1\n"; 33 34 ######################### End of black magic. 35 36@@ -19,26 +19,31 @@ print "ok 1\n"; 37 # (correspondingly "not ok 13") depending on the success of chunk 13 38 # of the test code): 39 40+$host = "127.0.0.1"; 41+$secret = "testing123"; 42+$user = "testing"; 43+$pwd = "testpassword"; 44+ 45 print "Make sure this machine is in your Radius clients file!\n"; 46-print "Enter hostname[:port] of your Radius server: "; chomp ($host = <STDIN>); 47-print "Enter shared-secret of your Radius server: "; chomp ($secret = <STDIN>); 48-print "Enter a username to be validated: "; chomp ($user = <STDIN>); 49-print "Enter this user's password: "; chomp ($pwd = <STDIN>); 50+print "hostname of your Radius server: $host\n"; 51+print "shared-secret of your Radius server: $secret\n"; 52+print "The username to be validated: $user\n"; 53+print "The user's password: $pwd\n"; 54 55 $t = 2; 56 if ($host ne '') { 57 $r = new Authen::Radius(Host => $host, Secret => $secret, Debug => 1); 58- print defined($r) ? "" : "not ", "ok $t\n"; $t++; 59+ print defined($r) ? "\nPASS: test$t\n" : "\nFAIL: test$t\n"; $t++; 60 #Authen::Radius->load_dictionary; 61- print $r->check_pwd($user, $pwd) ? "" : "not ", "ok $t\n"; $t++; 62+ print $r->check_pwd($user, $pwd) ? "\nPASS: test$t\n" : "\nFAIL: test$t\n"; $t++; 63 @a = $r->get_attributes; 64- print $#a != -1 ? "" : "not ", "ok $t\n"; $t++; 65+ print $#a != -1 ? "\nPASS: test$t\n" : "\nFAIL: test$t\n"; $t++; 66 #for $a (@a) { 67 # print "attr: name=$a->{'Name'} value=$a->{'Value'}\n"; 68 #} 69 } else { 70 foreach my $t (2..4) { 71- print "skipped $t\n"; 72+ print "\nSKIP test$t\n"; 73 } 74 } 75 76@@ -53,9 +58,9 @@ my $data = "what do ya want for nothing?"; 77 my $etalon_digest = hex_to_ascii("750c783e6ab0b503eaa86e310a5db738"); 78 my $digest = Authen::Radius::hmac_md5(undef, $data, $key); 79 if ($etalon_digest eq $digest) { 80- print "ok 5\n"; 81+ print "\nPASS: test5\n"; 82 } else { 83- print "not ok 5\n"; 84+ print "\nFAIL: test5\n"; 85 } 86 87 exit; 88-- 891.9.1 90 91