diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 17:11:11 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 17:11:11 +0000 |
commit | ba28aa09cebfba17fd16de2af6fedf7ecc76eea5 (patch) | |
tree | 44e2ff1493776a06e95c359c53a1cabca5d8a8d4 /t/01_testssl_banner.t | |
parent | Initial commit. (diff) | |
download | testssl.sh-ba28aa09cebfba17fd16de2af6fedf7ecc76eea5.tar.xz testssl.sh-ba28aa09cebfba17fd16de2af6fedf7ecc76eea5.zip |
Adding upstream version 3.2~rc3+dfsg.upstream/3.2_rc3+dfsgupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 't/01_testssl_banner.t')
-rwxr-xr-x | t/01_testssl_banner.t | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/t/01_testssl_banner.t b/t/01_testssl_banner.t new file mode 100755 index 0000000..032077a --- /dev/null +++ b/t/01_testssl_banner.t @@ -0,0 +1,49 @@ +#!/usr/bin/env perl + +# Basics: is there a syntax 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_regexp1='(syntax|parse) (e|E)rror'; +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([\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 ..."; +$fileout = `timeout 10 bash ./testssl.sh --banner 2>&1`; +my $retval=$?; + +unlike($fileout, qr/$error_regexp1/, "regex 1"); +$tests++; + +unlike($fileout, qr/$error_regexp2/, "regex 2"); +$tests++; + +unlike($fileout, qr/$error_regexp3/, "regex 3"); +$tests++; + +unlike($fileout, qr/$error_regexp4/, "regex 4"); +$tests++; + +unlike($fileout, qr/$error_regexp5/, "regex 5"); +$tests++; + +like($fileout, qr/$good_regexp/, "regex positive"); +$tests++; + +is($retval, 0, "return value should be equal zero: \"$retval\""); +$tests++; + +printf "\n"; +done_testing($tests); + + +# vim:ts=5:sw=5:expandtab + |