#!/usr/bin/perl use strict; use warnings; `make tests`; my $logwd = $ARGV[0]; my $pid = open(my $kid_to_read,"-|"); if($pid == 0){ print `./tests`; } else{ open(my $failed_tests,'>',"$logwd/test_fail.log"); open(my $test_output,'>',"$logwd/test_out.log"); my $fail = 0; while(<$kid_to_read>){ my $line = $_; if($line =~ /\Anot ok/){ print $failed_tests $line; $fail++; } print $test_output $line; } close $test_output; close $failed_tests; `make clean`; print $fail; }