| | 118 | sub prepare_results() { |
|---|
| | 119 | my $rv = 0; |
|---|
| | 120 | die "[*] $output_dir does not exist" unless -d $output_dir; |
|---|
| | 121 | die "[*] $logfile does not exist, has fwknop_test.pl been executed?" |
|---|
| | 122 | unless -e $logfile; |
|---|
| | 123 | if (-e $tarfile) { |
|---|
| | 124 | unlink $tarfile or die "[*] Could not unlink $tarfile: $!"; |
|---|
| | 125 | } |
|---|
| | 126 | |
|---|
| | 127 | ### create tarball |
|---|
| | 128 | system "tar cvfz $tarfile $logfile $output_dir"; |
|---|
| | 129 | print "[+] Test results file: $tarfile\n"; |
|---|
| | 130 | if (-e $tarfile) { |
|---|
| | 131 | $rv = 1; |
|---|
| | 132 | } |
|---|
| | 133 | return $rv; |
|---|
| | 134 | } |
|---|
| | 135 | |
|---|
| | 136 | sub setup() { |
|---|
| | 137 | |
|---|
| | 138 | $|++; ### turn off buffering |
|---|
| | 139 | |
|---|
| | 140 | die "[*] $conf_dir directory does not exist." unless -d $conf_dir; |
|---|
| | 141 | unless (-d $output_dir) { |
|---|
| | 142 | mkdir $output_dir or die "[*] Could not mkdir $output_dir: $!"; |
|---|
| | 143 | } |
|---|
| | 144 | |
|---|
| | 145 | for my $file (glob("$output_dir/cmd*")) { |
|---|
| | 146 | unlink $file or die "[*] Could not unlink($file)"; |
|---|
| | 147 | } |
|---|
| | 148 | |
|---|
| | 149 | for my $file (glob("$output_dir/*.warn")) { |
|---|
| | 150 | unlink $file or die "[*] Could not unlink($file)"; |
|---|
| | 151 | } |
|---|
| | 152 | |
|---|
| | 153 | for my $file (glob("$output_dir/*.die")) { |
|---|
| | 154 | unlink $file or die "[*] Could not unlink($file)"; |
|---|
| | 155 | } |
|---|
| | 156 | |
|---|
| | 157 | die "[*] $gpgdirCmd does not exist" unless -e $gpgdirCmd; |
|---|
| | 158 | die "[*] $gpgdirCmd not executable" unless -x $gpgdirCmd; |
|---|
| | 159 | |
|---|
| | 160 | if (-e $logfile) { |
|---|
| | 161 | unlink $logfile or die $!; |
|---|
| | 162 | } |
|---|
| | 163 | return; |
|---|
| | 164 | } |
|---|
| | 165 | |
|---|