mirror of
				https://github.com/drwetter/testssl.sh.git
				synced 2025-11-03 23:35:26 +01:00 
			
		
		
		
	Merge pull request #1461 from drwetter/ci_setx
add check for forgotten "set -x" + provide defined start conditions
This commit is contained in:
		@@ -14,7 +14,6 @@ my $error_regexp2='testssl.sh: line';
 | 
				
			|||||||
my $error_regexp3='bash: warning';
 | 
					my $error_regexp3='bash: warning';
 | 
				
			||||||
my $error_regexp4='command not found';
 | 
					my $error_regexp4='command not found';
 | 
				
			||||||
my $error_regexp5='(syntax error|unexpected token)';
 | 
					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';
 | 
					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 ...";
 | 
					printf "\n%s\n", "Testing whether just calling \"./testssl.sh --banner\" produces no error ...";
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										28
									
								
								t/03_set-x.t
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										28
									
								
								t/03_set-x.t
									
									
									
									
									
										Executable 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);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -22,6 +22,7 @@ die "Unable to open $prg" unless -f $prg;
 | 
				
			|||||||
my $uri="cloudflare.com";
 | 
					my $uri="cloudflare.com";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
printf "\n%s\n", "Unit testing JSON output ...";
 | 
					printf "\n%s\n", "Unit testing JSON output ...";
 | 
				
			||||||
 | 
					unlink 'tmp.json';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#1
 | 
					#1
 | 
				
			||||||
printf "%s\n", ".. plain JSON --> $uri ";
 | 
					printf "%s\n", ".. plain JSON --> $uri ";
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -19,6 +19,7 @@ my $check2run="--color 0 --htmlfile tmp.html";
 | 
				
			|||||||
die "Unable to open $prg" unless -f $prg;
 | 
					die "Unable to open $prg" unless -f $prg;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
printf "\n%s\n", "Doing HTML output checks";
 | 
					printf "\n%s\n", "Doing HTML output checks";
 | 
				
			||||||
 | 
					unlink 'tmp.html';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#1
 | 
					#1
 | 
				
			||||||
printf "%s\n", " .. running $prg against $uri to create HTML and terminal outputs (may take 2~3 minutes)";
 | 
					printf "%s\n", " .. running $prg against $uri to create HTML and terminal outputs (may take 2~3 minutes)";
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -17,6 +17,7 @@ $tests = 0;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
printf "\n%s\n", "Doing severity level checks";
 | 
					printf "\n%s\n", "Doing severity level checks";
 | 
				
			||||||
 | 
					unlink 'tmp.json';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#1
 | 
					#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++;
 | 
					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++;
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user