Merge pull request #1461 from drwetter/ci_setx

add check for forgotten "set -x" + provide defined start conditions
This commit is contained in:
Dirk Wetter 2020-01-20 12:20:07 +01:00 committed by GitHub
commit c08250d1bb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 31 additions and 1 deletions

View File

@ -14,7 +14,6 @@ my $error_regexp2='testssl.sh: line';
my $error_regexp3='bash: warning';
my $error_regexp4='command not found';
my $error_regexp5='(syntax error|unexpected token)';
# my $good_regexp='free software.*USAGE w/o ANY WARRANTY.*OWN RISK.*Using.*ciphers.*built(.*)platform';
my $good_regexp='free software([\s\S]*)USAGE w/o ANY WARRANTY([\s\S]*)OWN RISK([\s\S]*)Using([\s\S]*)ciphers([\s\S]*)built([\s\S]*)platform';
printf "\n%s\n", "Testing whether just calling \"./testssl.sh --banner\" produces no error ...";

28
t/03_set-x.t Executable file
View File

@ -0,0 +1,28 @@
#!/usr/bin/env perl
# Basics: is there a synatx error where already bash hiccups on?
# --banner is equal to --version
use strict;
use Test::More;
my $tests = 0;
my $fileout="";
# Blacklists we use to trigger an error:
my $error_regexp='^(\|)+([0-9])+>\s+[a-z]';
printf "\n%s\n", "Testing whether we forgot \"set -x\" ...";
$fileout = `./testssl.sh --help 2>&1`;
my $retval=$?;
unlike($fileout, qr/$error_regexp/, "just ran help");
$tests++;
$fileout = `./testssl.sh --ssl-native --color=0 --fast --ip=one google.com 2>&1`;
unlike($fileout, qr/$error_regexp/, "ran --ssl-native --color=0 --fast --ip=one google.com");
$tests++;
printf "\n";
done_testing($tests);

View File

@ -22,6 +22,7 @@ die "Unable to open $prg" unless -f $prg;
my $uri="cloudflare.com";
printf "\n%s\n", "Unit testing JSON output ...";
unlink 'tmp.json';
#1
printf "%s\n", ".. plain JSON --> $uri ";

View File

@ -19,6 +19,7 @@ my $check2run="--color 0 --htmlfile tmp.html";
die "Unable to open $prg" unless -f $prg;
printf "\n%s\n", "Doing HTML output checks";
unlink 'tmp.html';
#1
printf "%s\n", " .. running $prg against $uri to create HTML and terminal outputs (may take 2~3 minutes)";

View File

@ -17,6 +17,7 @@ $tests = 0;
printf "\n%s\n", "Doing severity level checks";
unlink 'tmp.json';
#1
pass(" .. running testssl.sh against badssl.com to create a JSON report with severity level equal greater than LOW (may take 2~3 minutes)"); $tests++;