From 8827b937c1e3d033655102a3d3c990db23f81484 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 16:21:55 +0100
Subject: [PATCH] - we now append the runner debug log into the timings debug
 log

---
 constants.php                |  5 ++++-
 protocolHeaderPartParser.php | 22 ++++++++++++++++++++++
 2 files changed, 26 insertions(+), 1 deletion(-)

diff --git a/constants.php b/constants.php
index 9d1762c..925ef69 100644
--- a/constants.php
+++ b/constants.php
@@ -3,7 +3,7 @@
 # variables
 
 //use this to know which version we published
-$versionString = '2.6.3';
+$versionString = '2.7.0';
 $rootDirNameToUseString = 'work';
 
 $isDebug = false; //logs debug to STDOUT
@@ -63,6 +63,8 @@ $regexMathAllFilesAttribute = '*';
 $responseNewLineString = '\r\n'; //to match interface
 $runnerNewLineString = "\\r\\n"; //starting with runner version 2.4
 
+$runnerDebugLogNewLineString = "\\n";
+
 
 # known error codes
 $status_code_Ok = 0;
@@ -151,6 +153,7 @@ $s_timeForUserProgram = 'timeForUserProgram';
 $s_output_without_header_part = 'stripedOutput';
 $s_characterLimitExceeded = 'characterLimitExceeded';
 $s_characterLimitUsed = 'characterLimitUsed';
+$s_headerKeyCharacterRunnerDebugLog = 'runnerDebugLog';
 
 $s_header_part_separator = "---\\r\\n";
 
diff --git a/protocolHeaderPartParser.php b/protocolHeaderPartParser.php
index 1ff7dc3..0788933 100644
--- a/protocolHeaderPartParser.php
+++ b/protocolHeaderPartParser.php
@@ -11,6 +11,9 @@ function parseHeaderPart($output)
     global $s_output_without_header_part;
     global $s_characterLimitExceeded;
     global $runnerNewLineString;
+    global $s_headerKeyCharacterRunnerDebugLog;
+
+    global $s_timings_string_separator;
 
 
     //if we have no header tuples we might have only so ---\n
@@ -24,6 +27,7 @@ function parseHeaderPart($output)
     $timeForCompiling = NULL;
     $timeForUserProgram = NULL;
     $characterLimitExceeded = FALSE;
+    $runnerDebugLogLines = [];
 
 
     $headerPartLines = explode($runnerNewLineString, $headerPartText);
@@ -67,7 +71,25 @@ function parseHeaderPart($output)
 
             $characterLimitExceeded = strtolower($val) === 'true';
 
+        } else if (strpos($line, $s_headerKeyCharacterRunnerDebugLog) === 0) {
+
+            $val = substr($line,   strlen($s_headerKeyCharacterRunnerDebugLog)+1);
+            if ($val === null) continue;
+
+
+            if (!empty($val)) {
+                $runnerDebugLogLines = explode($s_timings_string_separator, $val);
+                addToDebugTimings("--start runner debug lines");
+                #aadd the runner debug lines to the timings log
+                foreach ($runnerDebugLogLines as $runnerLogLine) {
+                    addToDebugTimings($runnerLogLine);
+                }
+                addToDebugTimings("--finish runner debug lines");
+            }
+
         }
+
+
     }
 
 
-- 
GitLab