11# !/usr/bin/env perl
22
33# Just a functional test, whether there are any problems on the client side
4- # Probably we could also inspect the JSON for any problems for
4+
5+ # We could also inspect the JSON for any problems for
56# "id" : "scanProblem"
67# "finding" : "Scan interrupted"
78
89use strict;
910use Test::More;
1011use Data::Dumper;
12+ # if needed: comment this and the lines below in:
1113# use JSON;
12- # if we need JSON we need to comment this and the lines below in
1314
1415my $tests = 0;
1516my $prg =" ./testssl.sh" ;
1617my $check2run =" --client-simulation -q --ip=one --color 0" ;
1718my $uri =" " ;
1819my $socket_out =" " ;
1920my $openssl_out =" " ;
20- # Blacklists we use to trigger an error:
21+ # Pattern we use to trigger an error:
2122my $socket_regex_bl =' (e|E)rror|\.\/testssl\.sh: line |(f|F)atal|(c|C)ommand not found' ;
2223my $openssl_regex_bl =' (e|E)rror|(f|F)atal|\.\/testssl\.sh: line |Oops|s_client connect problem|(c|C)ommand not found' ;
2324
@@ -30,15 +31,16 @@ STDOUT->autoflush(1);
3031
3132die " Unable to open $prg " unless -f $prg ;
3233
34+ # 1
3335$uri =" google.com" ;
34-
3536# unlink "tmp.json";
3637printf " \n %s \n " , " Client simulations unit test via sockets --> $uri ..." ;
3738$socket_out = ` $prg $check2run $uri 2>&1` ;
3839# $socket_json = json('tmp.json');
3940unlike($socket_out , qr /$socket_regex_bl / , " " );
4041$tests ++;
4142
43+ # 2 Makes little sense anymore but lets just keep this unit test
4244# unlink "tmp.json";
4345printf " \n %s \n " , " Client simulations unit test via OpenSSL --> $uri ..." ;
4446$openssl_out = ` $prg $check2run --ssl-native $uri 2>&1` ;
@@ -47,27 +49,19 @@ unlike($openssl_out, qr/$openssl_regex_bl/, "");
4749$tests ++;
4850
4951
52+ # 3
5053$uri =" smtp-relay.gmail.com:587" ;
51-
5254# unlink "tmp.json";
5355printf " \n %s \n " , " STARTTLS: Client simulations unit test via sockets --> $uri ..." ;
5456$socket_out = ` $prg $check2run -t smtp $uri 2>&1` ;
5557# $socket_json = json('tmp.json');
5658unlike($socket_out , qr /$socket_regex_bl / , " " );
5759$tests ++;
5860
59- # commented out, bc of travis' limits
60- #
6161# unlink "tmp.json";
62- # printf "\n%s\n", "STARTTLS: Client simulations unit test via OpenSSL --> $uri ...";
63- # $openssl_out = `$prg --ssl-native $check2run -t smtp $uri 2>&1`;
64- # # $openssl_json = json('tmp.json');
65- # unlike($openssl_out, qr/$openssl_regex_bl/, "");
66- # $tests++;
6762
6863done_testing($tests );
69- unlink " tmp.json" ;
70-
64+ printf " \n " ;
7165
7266
7367sub json ($) {
@@ -78,5 +72,5 @@ sub json($) {
7872}
7973
8074
81- # vim:ts=5:sw=5:expandtab
75+ # vim:ts=5:sw=5:expandtab
8276
0 commit comments