@@ -19,18 +19,24 @@ def run(root_path: str, args):
1919 file .write ("Sorry, this testing suite can only be ran on Darwin computers (MacOS)\n " )
2020 return "Sorry, this testing suite can only be ran on Darwin computers (MacOS)"
2121 with open (root_path + '/.mylibftunittest' , 'w+' ) as file :
22- result = subprocess .run (['make' , '-C' , root_path + '/testing_suites/libft-unit-test' , 'LIBFTDIR=' + args .path ], stdout = subprocess .PIPE , stderr = subprocess .STDOUT ).stdout .decode ('utf-8' )
22+ result = subprocess .run (['make' , 're' , ' -C' , root_path + '/testing_suites/libft-unit-test' , 'LIBFTDIR=' + args .path ], stdout = subprocess .PIPE , stderr = subprocess .STDOUT ).stdout .decode ('utf-8' )
2323 file .write (result )
2424 print (result )
2525 result = subprocess .run (['make' , 'f' , '-C' , root_path + '/testing_suites/libft-unit-test' , 'LIBFTDIR=' + args .path ], stdout = subprocess .PIPE , stderr = subprocess .STDOUT ).stdout .decode ('utf-8' )
2626 print (result )
2727 file .write (result )
2828 os .rename (root_path + '/testing_suites/libft-unit-test/result.log' , root_path + '/.mylibftunittest-results' )
2929 if args .do_benchmark :
30- result = subprocess .run ([root_path + '/testing_suites/libft-unit-test/run_test' , '-b' ], stdout = subprocess .PIPE , stderr = subprocess .STDOUT ).stdout .decode ('utf-8' )
30+ oldpwd = os .getcwd ()
31+ os .chdir (root_path + '/testing_suites/libft-unit-test/' )
32+ result = subprocess .run (['./run_test' , '-b' ], stdout = subprocess .PIPE , stderr = subprocess .STDOUT ).stdout .decode ('utf-8' )
33+ os .chdir (oldpwd )
3134 print (result )
3235 file .write (result )
33- # @todo: return results from benchmark
36+ with open (root_path + '/.mylibftunittest' , 'r' ) as file2 :
37+ for line in file2 :
38+ if "WINNER:" in line :
39+ benchmark_results = line
3440 with io .open (root_path + '/.mylibftunittest-results' , "r" , encoding = "ISO-8859-1" ) as file :
3541 data = file .read ()
3642 results = 'OKs: ' + str (data .count ('OK' )) + '\n '
@@ -40,4 +46,7 @@ def run(root_path: str, args):
4046 results += 'protected: ' + str (data .count ('protected' )) + '\n '
4147 results += 'not protected:' + str (data .count ('not protected' ))
4248 print (results )
43- return results
49+ if args .do_benchmark :
50+ return results , benchmark_results
51+ else :
52+ return results
0 commit comments