mirror of
https://github.com/drwetter/testssl.sh.git
synced 2024-12-29 04:49:44 +01:00
Finalize first diff check for travis
This commit is contained in:
parent
49d321cfbb
commit
a98ede0720
66
t/61_diff_testsslsh.t
Executable file
66
t/61_diff_testsslsh.t
Executable file
@ -0,0 +1,66 @@
|
||||
#!/usr/bin/env perl
|
||||
|
||||
# Baseline diff test against testssl, (csv output)
|
||||
#
|
||||
# We don't use a full run yet and omiy the certificate section.
|
||||
# There we would need to blacklist at least:
|
||||
# cert_serialNumber, cert_fingerprintSHA1, cert_fingerprintSHA256, cert
|
||||
# cert_expirationStatus, cert_notBefore, cert_notAfter, cert_caIssuers, intermediate_cert
|
||||
#
|
||||
# help is apreciated here
|
||||
|
||||
use strict;
|
||||
use Test::More;
|
||||
use Data::Dumper;
|
||||
use File::Compare;
|
||||
use Text::Diff;
|
||||
|
||||
my $tests = 0;
|
||||
my $prg="./testssl.sh";
|
||||
my $master_socket_csv="./t/baseline_data/default_testssl.csvfile";
|
||||
my $socket_csv="tmp.csv";
|
||||
my $check2run="-p -s -P --fs -h -U -c -q --ip=one --color 0 --csvfile $socket_csv";
|
||||
#my $check2run="-p --color 0 --csvfile $socket_csv";
|
||||
my $uri="testssl.sh";
|
||||
my $diff="";
|
||||
|
||||
die "Unable to open $prg" unless -f $prg;
|
||||
die "Unable to open $master_socket_csv" unless -f $master_socket_csv;
|
||||
|
||||
|
||||
# Provide proper start conditions
|
||||
unlink "tmp.csv";
|
||||
|
||||
# Title
|
||||
printf "\n%s\n", "Diff unit test IPv4 against \"$uri\"";
|
||||
|
||||
#1 run
|
||||
`$prg $check2run $uri 2>&1`;
|
||||
|
||||
|
||||
$diff = diff $socket_csv, $master_socket_csv;
|
||||
|
||||
$socket_csv=`cat tmp.csv`;
|
||||
$master_socket_csv=`cat $master_socket_csv`;
|
||||
|
||||
# Filter, for now only HTTP_clock_skew
|
||||
$socket_csv=~ s/HTTP_clock_skew.*\n//g;
|
||||
$master_socket_csv=~ s/HTTP_clock_skew.*\n//g;
|
||||
|
||||
# Compare and print the differences if there are some
|
||||
# Filtering takes place later, so if ther will be a difference detected
|
||||
# it'll also show HTTP_clock_skew
|
||||
#
|
||||
cmp_ok($socket_csv, "eq", $master_socket_csv, "Check whether CSV output matches master file from $uri") and
|
||||
printf "\n%s\n", "$diff";
|
||||
|
||||
$tests++;
|
||||
|
||||
unlink "tmp.csv";
|
||||
|
||||
done_testing($tests);
|
||||
printf "\n";
|
||||
|
||||
|
||||
# vim:tw=95:ts=5:sw=5:et
|
||||
|
Loading…
Reference in New Issue
Block a user