From 2ae897c31a50a3eac33cefaa09f0be67701e8f58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Janis=20Da=CC=88hne?= <janis.daehne@informatik.uni-halle.de> Date: Fri, 5 Mar 2021 14:33:59 +0100 Subject: [PATCH] - added more logging --- constants.php | 2 +- do_blackBoxTest_func.php | 10 +++++++++- do_compareFilesTest_func.php | 3 +++ do_compileTest_func.php | 4 ++++ transactionHelper.php | 12 ++++++++++++ 5 files changed, 29 insertions(+), 2 deletions(-) diff --git a/constants.php b/constants.php index bb44269..984cbc3 100644 --- a/constants.php +++ b/constants.php @@ -3,7 +3,7 @@ # variables //use this to know which version we published -$versionString = '2.6.1'; +$versionString = '2.6.2'; $rootDirNameToUseString = 'work'; $isDebug = false; //logs debug to STDOUT diff --git a/do_blackBoxTest_func.php b/do_blackBoxTest_func.php index 31149c9..451824b 100644 --- a/do_blackBoxTest_func.php +++ b/do_blackBoxTest_func.php @@ -73,6 +73,8 @@ function do_blackBoxTest($conn, $traceString, $sourceCode, $mainFileNameWithExt $testContent = $test[$s_test_content]; $allAssets = $test[$s_test_allAssets]; + addToDebugTimings("before creating test assets"); + # create the assets for the current test if (createTestAssets($allAssets, $fullWorkingDirPath) === FALSE) { //error message is in createFiles function @@ -85,6 +87,7 @@ function do_blackBoxTest($conn, $traceString, $sourceCode, $mainFileNameWithExt $s_timeForUserProgram => NULL, ); } + addToDebugTimings("after creating test assets"); $longCmd = $config['runner'] @@ -110,7 +113,6 @@ function do_blackBoxTest($conn, $traceString, $sourceCode, $mainFileNameWithExt require_once './transactionHelper.php'; addTraceLogToDb($conn, $config, $traceString, $longCmd, $sourceCode); - if ($isDebug) { debug("using runner: " . $config['runner']); debug("full command: " . $longCmd); @@ -133,6 +135,8 @@ function do_blackBoxTest($conn, $traceString, $sourceCode, $mainFileNameWithExt $env = $config['environmentVarsParsed']; + addToDebugTimings("starting runner"); + # without bypass_shell it won't work on windows $process = proc_open($longCmd, $pipesDescriptor, $pipes, $fullWorkingDirPath, $env, array('bypass_shell' => TRUE)); @@ -166,6 +170,8 @@ function do_blackBoxTest($conn, $traceString, $sourceCode, $mainFileNameWithExt debug("error during execution of the (blackbox) test runner: " . $errorOutput); } + addToDebugTimings("finished runner"); + # the test assets are removed when the dir gets removed # also the test runner could renamed/added/deleted some files @@ -185,6 +191,8 @@ function do_blackBoxTest($conn, $traceString, $sourceCode, $mainFileNameWithExt $compileTimeout = intval($compileTimeout, 10); } + addToDebugTimings("finished parsing runner header"); + return array( $s_return_val => $return_var, $s_output => $headerPart[$s_output_without_header_part], diff --git a/do_compareFilesTest_func.php b/do_compareFilesTest_func.php index ff02eae..a83b412 100644 --- a/do_compareFilesTest_func.php +++ b/do_compareFilesTest_func.php @@ -134,6 +134,8 @@ function do_compareFilesTest($conn, $traceString, $sourceCode, $mainFileNameWith $env = $config['environmentVarsParsed']; + addToDebugTimings("starting runner"); + # without bypass_shell it won't work on windows $process = proc_open($longCmd, $pipesDescriptor, $pipes, $fullWorkingDirPath, $env, array('bypass_shell' => TRUE)); @@ -167,6 +169,7 @@ function do_compareFilesTest($conn, $traceString, $sourceCode, $mainFileNameWith debug("error during execution of the (blackbox) test runner: " . $errorOutput); } + addToDebugTimings("finished runner"); # the test assets are removed when the dir gets removed # also the test runner could renamed/added/deleted some files diff --git a/do_compileTest_func.php b/do_compileTest_func.php index da51206..87ec072 100644 --- a/do_compileTest_func.php +++ b/do_compileTest_func.php @@ -77,6 +77,8 @@ function do_compile($conn, $traceString, $sourceCode, $mainFileNameWithExtension 2 => array("pipe", "w") ); + addToDebugTimings("starting runner"); + $process = proc_open($longCmd, $descriptorspec, $pipes, $fullWorkingDirPath, $env, array('bypass_shell' => TRUE)); if (is_resource($process)) { @@ -94,6 +96,8 @@ function do_compile($conn, $traceString, $sourceCode, $mainFileNameWithExtension debug("error during execution of the (compile) test runner: " . $errorOutput); } + addToDebugTimings("finished runner"); + $headerPart = parseHeaderPart($output); # in case the test runner didn't even run we may need to cast (vals from db) diff --git a/transactionHelper.php b/transactionHelper.php index afb065a..8720df9 100644 --- a/transactionHelper.php +++ b/transactionHelper.php @@ -58,6 +58,8 @@ function addTraceLogToDb($conn, $config, $traceString, $processString, $sourceCo if ($insertTraceLogs === TRUE) { + addToDebugTimings("before inserting trace log"); + debug(strlen($sourceCode)); $tableName = $config[$s_arg_dbTraceTableName]; @@ -74,6 +76,8 @@ function addTraceLogToDb($conn, $config, $traceString, $processString, $sourceCo output($status_code_DbIssue, 'could not add trace log'); exit(1); } + + addToDebugTimings("after inserting trace log"); } } @@ -98,6 +102,8 @@ function removeOldTraceLogs($conn, $config, $s_deleteTraceLogOlderThanMinutes) { if ($deleteTraceLogOlderThanMinutes > 0) { + addToDebugTimings("before deleting old trace logs"); + $sql = "DELETE FROM `" . $tableName . "` WHERE dateTime < (NOW() - INTERVAL :olderThan MINUTE);"; $params = array( ':olderThan' => $deleteTraceLogOlderThanMinutes @@ -108,9 +114,13 @@ function removeOldTraceLogs($conn, $config, $s_deleteTraceLogOlderThanMinutes) { output($status_code_DbIssue, 'could not remove old trace logs'); exit(1); } + + addToDebugTimings("after deleting old trace logs"); } else if ($deleteTraceLogOlderThanMinutes === 0){ + addToDebugTimings("before deleting all old trace logs"); + $sql = "DELETE FROM `" . $tableName . "`;"; $params = array( ':olderThan' => $deleteTraceLogOlderThanMinutes @@ -121,6 +131,8 @@ function removeOldTraceLogs($conn, $config, $s_deleteTraceLogOlderThanMinutes) { output($status_code_DbIssue, 'could not remove all old trace logs'); exit(1); } + + addToDebugTimings("after deleting all old trace logs"); } } -- GitLab