From df7e23137db654daf4842f2ed21698b3e7c8fe87 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Janis=20Daniel=20Da=CC=88hne?=
 <janis.daehne2@student.uni-halle.de>
Date: Sat, 23 Feb 2019 15:27:05 +0100
Subject: [PATCH] - changed backupDb to use the new server setup names -
 changed environmentVars to use \r\n as delimiter (because phpMyAdmin uses
 this)

---
 backupDb/0_plangs_server.sql       | 21 +++++++++++----------
 backupDb/1_transactions_server.sql | 18 +++++++++---------
 backupDb/2_config_server.sql       | 26 ++++++++++++++------------
 bootstrap.php                      |  2 +-
 readme.md                          |  7 +++----
 5 files changed, 38 insertions(+), 36 deletions(-)

diff --git a/backupDb/0_plangs_server.sql b/backupDb/0_plangs_server.sql
index ac410a6..50e7027 100644
--- a/backupDb/0_plangs_server.sql
+++ b/backupDb/0_plangs_server.sql
@@ -1,11 +1,11 @@
 -- phpMyAdmin SQL Dump
--- version 4.2.12deb2+deb8u3
--- http://www.phpmyadmin.net
+-- version 4.6.6deb4
+-- https://www.phpmyadmin.net/
 --
 -- Host: localhost
--- Erstellungszeit: 20. Feb 2019 um 19:01
--- Server Version: 5.5.62-0+deb8u1
--- PHP-Version: 5.6.39-0+deb8u1
+-- Erstellungszeit: 23. Feb 2019 um 14:56
+-- Server-Version: 10.1.37-MariaDB-0+deb9u1
+-- PHP-Version: 7.0.33-0+deb9u1
 
 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
 SET time_zone = "+00:00";
@@ -14,10 +14,10 @@ SET time_zone = "+00:00";
 /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
 /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
 /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
-/*!40101 SET NAMES utf8 */;
+/*!40101 SET NAMES utf8mb4 */;
 
 --
--- Datenbank: `syndromtestdb`
+-- Datenbank: `yapexTestDb`
 --
 
 -- --------------------------------------------------------
@@ -26,7 +26,7 @@ SET time_zone = "+00:00";
 -- Tabellenstruktur für Tabelle `plangs`
 --
 
-CREATE TABLE IF NOT EXISTS `plangs` (
+CREATE TABLE `plangs` (
   `internalName` varchar(100) NOT NULL,
   `compile` text NOT NULL,
   `exec` text NOT NULL,
@@ -41,7 +41,8 @@ CREATE TABLE IF NOT EXISTS `plangs` (
 --
 
 INSERT INTO `plangs` (`internalName`, `compile`, `exec`, `hardTimeoutInMs`, `hardMemoryLimitInKb`, `hardDiskSpaceLimitInKb`, `extensions`) VALUES
-('java', '\\"javac\\" \\"-encoding\\" \\"UTF8\\" \\"#5\\"', '\\"java\\" \\"-Dfile.encoding=UTF8\\" \\"-cp\\" \\"#1\\" \\"#2\\"', 3000, 2000, 2000, '["java"]');
+('C', '\\\"gcc\\\" \\\"#5\\\"', '\\\"#1/a.out\\\"', 3000, 2000, 2000, '[\"c\"]'),
+('java', '\\\"javac\\\" \\\"-encoding\\\" \\\"UTF8\\\" \\\"#5\\\"', '\\\"java\\\" \\\"-Dfile.encoding=UTF8\\\" \\\"-cp\\\" \\\"#1\\\" \\\"#2\\\"', 3000, 2000, 2000, '[\"java\"]');
 
 --
 -- Indizes der exportierten Tabellen
@@ -51,7 +52,7 @@ INSERT INTO `plangs` (`internalName`, `compile`, `exec`, `hardTimeoutInMs`, `har
 -- Indizes für die Tabelle `plangs`
 --
 ALTER TABLE `plangs`
- ADD PRIMARY KEY (`internalName`);
+  ADD PRIMARY KEY (`internalName`);
 
 /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
 /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
diff --git a/backupDb/1_transactions_server.sql b/backupDb/1_transactions_server.sql
index 54bfa31..f216746 100644
--- a/backupDb/1_transactions_server.sql
+++ b/backupDb/1_transactions_server.sql
@@ -1,11 +1,11 @@
 -- phpMyAdmin SQL Dump
--- version 4.2.12deb2+deb8u3
--- http://www.phpmyadmin.net
+-- version 4.6.6deb4
+-- https://www.phpmyadmin.net/
 --
 -- Host: localhost
--- Erstellungszeit: 20. Feb 2019 um 19:00
--- Server Version: 5.5.62-0+deb8u1
--- PHP-Version: 5.6.39-0+deb8u1
+-- Erstellungszeit: 23. Feb 2019 um 14:56
+-- Server-Version: 10.1.37-MariaDB-0+deb9u1
+-- PHP-Version: 7.0.33-0+deb9u1
 
 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
 SET time_zone = "+00:00";
@@ -14,10 +14,10 @@ SET time_zone = "+00:00";
 /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
 /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
 /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
-/*!40101 SET NAMES utf8 */;
+/*!40101 SET NAMES utf8mb4 */;
 
 --
--- Datenbank: `syndromtestdb`
+-- Datenbank: `yapexTestDb`
 --
 
 -- --------------------------------------------------------
@@ -26,7 +26,7 @@ SET time_zone = "+00:00";
 -- Tabellenstruktur für Tabelle `transactions`
 --
 
-CREATE TABLE IF NOT EXISTS `transactions` (
+CREATE TABLE `transactions` (
   `id` varchar(50) NOT NULL,
   `rootDirName` varchar(50) NOT NULL,
   `testType` text
@@ -40,7 +40,7 @@ CREATE TABLE IF NOT EXISTS `transactions` (
 -- Indizes für die Tabelle `transactions`
 --
 ALTER TABLE `transactions`
- ADD PRIMARY KEY (`id`);
+  ADD PRIMARY KEY (`id`);
 
 /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
 /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
diff --git a/backupDb/2_config_server.sql b/backupDb/2_config_server.sql
index f24cf3f..3fdf6a6 100644
--- a/backupDb/2_config_server.sql
+++ b/backupDb/2_config_server.sql
@@ -1,11 +1,11 @@
 -- phpMyAdmin SQL Dump
--- version 4.2.12deb2+deb8u3
--- http://www.phpmyadmin.net
+-- version 4.6.6deb4
+-- https://www.phpmyadmin.net/
 --
 -- Host: localhost
--- Erstellungszeit: 20. Feb 2019 um 19:01
--- Server Version: 5.5.62-0+deb8u1
--- PHP-Version: 5.6.39-0+deb8u1
+-- Erstellungszeit: 23. Feb 2019 um 14:54
+-- Server-Version: 10.1.37-MariaDB-0+deb9u1
+-- PHP-Version: 7.0.33-0+deb9u1
 
 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
 SET time_zone = "+00:00";
@@ -14,10 +14,10 @@ SET time_zone = "+00:00";
 /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
 /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
 /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
-/*!40101 SET NAMES utf8 */;
+/*!40101 SET NAMES utf8mb4 */;
 
 --
--- Datenbank: `syndromtestdb`
+-- Datenbank: `yapexTestDb`
 --
 
 -- --------------------------------------------------------
@@ -26,24 +26,26 @@ SET time_zone = "+00:00";
 -- Tabellenstruktur für Tabelle `config`
 --
 
-CREATE TABLE IF NOT EXISTS `config` (
+CREATE TABLE `config` (
   `id` int(11) NOT NULL,
   `workingDirFullPath` text NOT NULL,
   `hardGlobalTimeoutInMs` int(11) NOT NULL,
   `maxParallelTests` int(11) NOT NULL,
   `maxNumberOfTestsWithOneRequest` int(11) NOT NULL,
   `runner` text NOT NULL,
+  `showTestRunnerDebugOutput` tinyint(1) NOT NULL DEFAULT '0',
   `maxLinesToRead` int(11) NOT NULL,
   `maxErrLinesToRead` int(11) NOT NULL,
-  `maxLinesToWrite` int(11) NOT NULL
+  `maxLinesToWrite` int(11) NOT NULL,
+  `environmentVars` text
 ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
 
 --
 -- Daten für Tabelle `config`
 --
 
-INSERT INTO `config` (`id`, `workingDirFullPath`, `hardGlobalTimeoutInMs`, `maxParallelTests`, `maxNumberOfTestsWithOneRequest`, `runner`, `maxLinesToRead`, `maxErrLinesToRead`, `maxLinesToWrite`) VALUES
-(1, '/syndromtests/tests', 3000, 100, 15, '"java" -Dfile.encoding=UTF8 -cp "/syndromtests/LinuxSafeTestRunner" Main', 1000, 1000, 1000);
+INSERT INTO `config` (`id`, `workingDirFullPath`, `hardGlobalTimeoutInMs`, `maxParallelTests`, `maxNumberOfTestsWithOneRequest`, `runner`, `showTestRunnerDebugOutput`, `maxLinesToRead`, `maxErrLinesToRead`, `maxLinesToWrite`, `environmentVars`) VALUES
+(1, '/opt/yapex/_tests', 4000, 100, 15, '\"java\" -Dfile.encoding=UTF8 -cp \"/opt/yapex/LinuxSafeTestRunner/src\" Main', 1, 500, 500, 500, 'USER=yapextester\r\nHOME=/home/yapextester\r\nLANG=de_DE.UTF-8\r\nPATH=/usr/local/bin:/usr/bin:/bin');
 
 --
 -- Indizes der exportierten Tabellen
@@ -53,7 +55,7 @@ INSERT INTO `config` (`id`, `workingDirFullPath`, `hardGlobalTimeoutInMs`, `maxP
 -- Indizes für die Tabelle `config`
 --
 ALTER TABLE `config`
- ADD PRIMARY KEY (`id`);
+  ADD PRIMARY KEY (`id`);
 
 /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
 /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
diff --git a/bootstrap.php b/bootstrap.php
index 6408c7e..dc03cf6 100644
--- a/bootstrap.php
+++ b/bootstrap.php
@@ -73,7 +73,7 @@ $config['environmentVars'] = $row['environmentVars'];
 
 //parse environmentVars
 if (isset($config['environmentVars'])) {
-    $keyValuePairs = explode("\n", $config['environmentVars']);
+    $keyValuePairs = explode("\r\n", $config['environmentVars']);
     $config['environmentVarsParsed'] = $keyValuePairs;
 } else {
     $config['environmentVarsParsed'] = NULL;
diff --git a/readme.md b/readme.md
index 962ac45..48699b0 100644
--- a/readme.md
+++ b/readme.md
@@ -384,13 +384,12 @@ A json object with the following properties (order does not matter)
 * **dbConfigPw** : (string) -''- but for the config table
 * **dbConfigTableName**: (string) the table name with the configuration (the *dbServer* and *dbName* options are used)
 
-* **environmentVars** : (string, \n separated, key value pairs are separated by = OR NULL) the environment variables for the test runner. All environment vars are cleared and only these are set (even if this is the empty string). The special delimiters `\n` and `=` must not be used inside keys or values. 
+* **environmentVars** : (string, \r\n separate (phpmyadmin will auto use \r\n if you press enter)d, key value pairs are separated by = OR NULL) the environment variables for the test runner. All environment vars are cleared and only these are set (even if this is the empty string). The special delimiters `\n` and `=` must not be used inside keys or values. 
   The test runner is called and these environment variables are set.
   You can use `"path""` to escape paths or other strings
-  It is recommended that you at least specify the following: `PWD, USER, HOME ,PATH`
+  It is recommended that you at least specify the following: `USER, HOME ,PATH`
   * `USER` is the executing user e.g. `yapextester`
   * `HOME` is the home path for the executing user e.g. `/home/yapextester`
-  * `PWD` is the current path e.g. `/opt/yapex/TestServer` or empty (string)
   * `LANG` the lang to use (e.g. for default formatting) e.g. `de_DE.UTF-8`
   * `PATH` are the paths that unix/windows should include when searching for e.g. programs `/usr/local/bin:/usr/bin:/bin:/`
   **Note** that this is for linux, windows handles environment variables differently (e.g. other multi value  separator than `:`)
@@ -416,7 +415,7 @@ If the config table has more than 1 row, the first row is taken!
     "maxNumberOfTestsWithOneRequest": 20,
     "runner": "\"C:\\Program Files (x86)\\JetBrains\\IntelliJ IDEA 14.1.4\\jdk1.8.0_65\\bin\\java\" -cp \"C:\\Users\\theju\\Documents\\WebProjects\\SyndromeAll\\DefaultTestRunner\\out\\production\\DefaultTestRunner\" Main",
     
-    "environmentVars": "USER=yapextester\nHOME=/home/yapextester\nPWD=\nLANG=de_DE.UTF-8\nPATH=/usr/local/bin:/usr/bin:/bin:/"
+    "environmentVars": "USER=yapextester\r\nHOME=/home/yapextester\r\nPWD=\r\nLANG=de_DE.UTF-8\r\nPATH=/usr/local/bin:/usr/bin:/bin:/"
 }
 ```
 
-- 
GitLab