]> git.gsnw.org Git - fping.git/commitdiff
more tests
authorDavid Schweikert <david@schweikert.ch>
Fri, 2 May 2014 21:26:16 +0000 (23:26 +0200)
committerDavid Schweikert <david@schweikert.ch>
Fri, 2 May 2014 21:26:16 +0000 (23:26 +0200)
ci/test-11-nopriv.pl [new file with mode: 0644]

diff --git a/ci/test-11-nopriv.pl b/ci/test-11-nopriv.pl
new file mode 100644 (file)
index 0000000..7f90f0e
--- /dev/null
@@ -0,0 +1,25 @@
+#!/usr/bin/perl -w
+
+use Test::Command tests => 6;
+
+# run without privileges
+my $fping_bin = `which fping`; chomp $fping_bin;
+my $fping6_bin = `which fping6`; chomp $fping6_bin;
+system("cp $fping_bin /tmp/fping.copy; chmod +x /tmp/fping.copy");
+system("cp $fping6_bin /tmp/fping6.copy; chmod +x /tmp/fping6.copy");
+
+# fping
+{
+my $cmd = Test::Command->new(cmd => "/tmp/fping.copy 127.0.0.1");
+$cmd->exit_is_num(4);
+$cmd->stdout_is_eq("");
+$cmd->stderr_is_eq("(null): can't create socket (must run as root?) : Permission denied\n");
+}
+
+# fping6
+{
+my $cmd = Test::Command->new(cmd => "/tmp/fping6.copy ::1");
+$cmd->exit_is_num(4);
+$cmd->stdout_is_eq("");
+$cmd->stderr_is_eq("(null): can't create raw socket (must run as root?) : Protocol not supported\n");
+}