1: #!/usr/bin/perl
2:
3: # path to command
4: $axl_knife = "../knife/axl-knife";
5: chomp ($diff = `which diff`);
6:
7: sub run_cmd {
8: # get string
9: my $string = $_[0];
10:
11: $result = system ($string);
12: if ($result != 0) {
13: print ("ERROR: found error code ($result) while running $string..\n");
14: exit (-1);
15: }
16: return $result;
17: }
18:
19: sub test_01 () {
20:
21: ### test ####
22: # call to produce knife representation check with reference
23: run_cmd ("$axl_knife -i knife.test_01.xml -o knife.test_01.xml.tmp -e");
24:
25: # call to get differences
26: run_cmd ("$diff knife.test_01.xml.tmp knife.test_01.ref");
27:
28: ### test ####
29: # call to produce knife representation check with reference
30: run_cmd ("$axl_knife -i knife.test_01.b.xml -o knife.test_01.xml.b.tmp -e");
31:
32: # call to get differences
33: run_cmd ("$diff knife.test_01.xml.b.tmp knife.test_01.b.ref");
34:
35: ### test ####
36: # call to produce knife representation check with reference
37: run_cmd ("$axl_knife -i knife.test_01.c.xml -o knife.test_01.xml.c.tmp -e");
38:
39: # call to get differences
40: run_cmd ("$diff knife.test_01.xml.c.tmp knife.test_01.c.ref");
41:
42: ### test ####
43: # call to produce knife representation check with reference
44: run_cmd ("$axl_knife -i knife.test_01.d.xml -o knife.test_01.xml.d.tmp -e");
45:
46: # call to get differences
47: run_cmd ("$diff knife.test_01.xml.d.tmp knife.test_01.d.ref");
48:
49: return 1;
50: }
51:
52:
53: ########
54: # MAIN #
55: ########
56:
57: # check if the command is defined
58: if (! -e $axl_knife) {
59: print ("ERROR: unable to find axl-knife tool at: $axl_knife..\n");
60: exit (-1);
61: }
62:
63: if (! test_01 ()) {
64: print ("Test 01: check htmlize function [ FAILED ]\n");
65: exit (-1);
66: } else {
67: print ("Test 01: check htmlize function [ OK ]\n");
68: }
69:
70: print ("All tests ok!\n");
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>