vsys tests to send to Tony
[vsys.git] / tests / runtest.pl
1 #!/usr/bin/perl
2
3 # Subtest #1 Create new vsys entry
4
5 print "Creating entries...\t";
6
7 $vsys_entry="#!/bin/bash\n\ncat /etc/passwd";
8 $vsys_entry_acl = "/vservers/pl_netflow pl_netflow";
9
10 open ACL,">/vsys/test.acl" || die ("Could not create acl for test entry.");
11 print ACL $vsys_entry_acl;
12 close ACL;
13
14 open FIL,">/vsys/test" || die ("Could not create test entry.");
15 print FIL $vsys_entry;
16 close $vsys_entry;
17
18 # Check if it has shown up
19
20 (-f "/vservers/pl_netflow/test.in") || die ("in file didn't show up in the slice");
21 (-f "/vservers/pl_netflow/test.out") || die ("out file didn't show up in the slice");
22
23 # OK, SUBTEST #1 SUCCEEDED
24 print "(success)\n";
25
26 # Subtest #2 
27
28 print "Multiple-connection test...\t";
29 system("su -c ./conctest pl_netflow -");
30 ($? && die ("Multiple-connection test failed\n"));
31
32
33 # OK, SUBTEST #2 SUCCEEDED
34 print "(success)\n";
35
36 # Subtest #3
37 unlink "/vsys/test.acl";
38 unlink "/vsys/test";
39
40 (-f "/vservers/pl_netflow/test.in" || -f "/vservers/pl_netflow/test.out") && die ("cleanup failed");
41