aboutsummaryrefslogtreecommitdiffstats
path: root/meta-perl/recipes-perl/libauthen/libauthen-radius-perl/test.pl-adjust-for-ptest.patch
blob: 9798af497cddda23273150e026eb8494f604fb1e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
From 829302792bf0e4935d29efc23ca1f2e9e7ee7dfd Mon Sep 17 00:00:00 2001
From: Jackie Huang <jackie.huang@windriver.com>
Date: Thu, 7 Jan 2016 03:12:38 -0500
Subject: [PATCH] test.pl: adjust for ptest

* Don't use interactive inputs, set default test
  settings instead.
* Change the test results output to the ptest format

Upstream-Status: Inappropriate [OE ptest specific]

Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
---
 test.pl | 31 ++++++++++++++++++-------------
 1 file changed, 18 insertions(+), 13 deletions(-)

diff --git a/test.pl b/test.pl
index cfd1c1e..9b4f10e 100644
--- a/test.pl
+++ b/test.pl
@@ -7,11 +7,11 @@
 # Change 1..1 below to 1..last_test_to_print .
 # (It may become useful if the test is moved to ./t subdirectory.)
 
-BEGIN {print "1..5\n";}
-END {print "not ok 1\n" unless $loaded;}
+BEGIN {print "Start testing for libauthen-radius-perl\n";}
+END {print "\nFAIL: test1\n" unless $loaded;}
 use Authen::Radius;
 $loaded = 1;
-print "ok 1\n";
+print "\nPASS: test1\n";
 
 ######################### End of black magic.
 
@@ -19,26 +19,31 @@ print "ok 1\n";
 # (correspondingly "not ok 13") depending on the success of chunk 13
 # of the test code):
 
+$host = "127.0.0.1";
+$secret = "testing123";
+$user = "testing";
+$pwd = "testpassword";
+
 print "Make sure this machine is in your Radius clients file!\n";
-print "Enter hostname[:port] of your Radius server: "; chomp ($host = <STDIN>);
-print "Enter shared-secret of your Radius server: "; chomp ($secret = <STDIN>);
-print "Enter a username to be validated: "; chomp ($user = <STDIN>);
-print "Enter this user's password: "; chomp ($pwd = <STDIN>);
+print "hostname of your Radius server: $host\n";
+print "shared-secret of your Radius server: $secret\n";
+print "The username to be validated: $user\n";
+print "The user's password: $pwd\n";
 
 $t = 2;
 if ($host ne '') {
 	$r = new Authen::Radius(Host => $host, Secret => $secret, Debug => 1);
-	print defined($r) ? "" : "not ", "ok $t\n"; $t++;
+	print defined($r) ? "\nPASS: test$t\n" : "\nFAIL: test$t\n"; $t++;
 	#Authen::Radius->load_dictionary;
-	print $r->check_pwd($user, $pwd) ? "" : "not ", "ok $t\n"; $t++;
+	print $r->check_pwd($user, $pwd) ? "\nPASS: test$t\n" : "\nFAIL: test$t\n"; $t++;
 	@a = $r->get_attributes;
-	print $#a != -1 ? "" : "not ", "ok $t\n"; $t++;
+	print $#a != -1 ? "\nPASS: test$t\n" : "\nFAIL: test$t\n"; $t++;
 	#for $a (@a) {
 	#	print "attr: name=$a->{'Name'} value=$a->{'Value'}\n";
 	#}
 } else {
 	foreach my $t (2..4) {
-		print "skipped $t\n";
+		print "\nSKIP test$t\n";
 	}
 }
 
@@ -53,9 +58,9 @@ my $data = "what do ya want for nothing?";
 my $etalon_digest = hex_to_ascii("750c783e6ab0b503eaa86e310a5db738");
 my $digest = Authen::Radius::hmac_md5(undef, $data, $key);
 if ($etalon_digest eq $digest) {
-	print "ok 5\n";
+	print "\nPASS: test5\n";
 } else {
-	print "not ok 5\n";
+	print "\nFAIL: test5\n";
 }
 
 exit;
-- 
1.9.1