From c8c2822e5ea92ceedee4368bc3add8f4623e27e5 Mon Sep 17 00:00:00 2001
From: Daniel Smith <daniel.smith@qt.io>
Date: Fri, 29 Nov 2019 09:32:18 +0100
Subject: [PATCH] Make Bisect regression percentage required

---
 server.js | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

diff --git a/server.js b/server.js
index 3d0e5e3..852f310 100644
--- a/server.js
+++ b/server.js
@@ -85,6 +85,8 @@ if (process.argv[2] == 'standalone'){ // Startup in standalone mode
       console.log(`Got slave ${index - 2}: ${val}`);
     }
   });
+}else if (process.argv[2] == 'refreshrepos'){ // Startup with a local worker
+  gatherTestNames(true, function(){process.exit(0);});
 } else if (process.argv[2] != undefined){ // Assume all our arguments are slave worker IPs.
   isPrimaryHost = true;
 
@@ -1127,7 +1129,7 @@ function schedulerPage(req, res) {
     <input id='benchmarkButtonBisect' type='button' value='Upload custom benchmark' /><br>
     <hr style="width:20%">
     <label for="expected_regression">Expected regression, in percentage: </label>
-    <input id="expected_regression" type="number" min="2" max="100" style="width:40;" name="expected_regression" value="" placeholder="20">%<br>
+    <input id="expected_regression" type="number" min="2" max="100" style="width:40;" name="expected_regression" value="" placeholder="20" required>%<br>
     <p><b>Note:</b> Be conservative with the regression target.<br>It is not recommended to search for regressions below 5% due to test noise.</p>
     <hr style="width:20%">
     <label for="test_hosts">Run job on host:</label><br>
@@ -1992,12 +1994,12 @@ if (!fs.existsSync(pathmodule.join(os.homedir(), 'QMLBenchRegressionLogs', mynam
   fs.mkdirSync(pathmodule.join(os.homedir(), 'QMLBenchRegressionLogs', myname, 'results'));
 }
 
-function gatherTestNames(forceUpdate){
+function gatherTestNames(forceUpdate, callback){
   // Gather test names for partial match suggestions on the scheduler page. If QMLBench isn't already initialized, do it now and block the scheduler.
 
   function loadTests(){
     var walk = require('walk');
-
+    testNames.length = 0;
     // Walker options
     var walker = walk.walk('./QtBuild/qmlbench/benchmarks/', { followLinks: false });
 
@@ -2012,6 +2014,9 @@ function gatherTestNames(forceUpdate){
 
     walker.on('end', function() {
       console.log(`Loaded ${testNames.length} tests from QMLBench.`);
+      if(callback){
+        callback();
+      }
     });
   }
 
@@ -2037,6 +2042,14 @@ function gatherTestNames(forceUpdate){
     var pythonexe = os.platform() == 'win32' ? 'python' : 'python3'; // Python3 for windows will simply be 'python'.
     const testProcess = spawn(pythonexe, ['regressionFinder.py', '--setupEnv'], os.platform() == 'win32' ? {detached: false} : {detached: true});
     runningJob.processHandle = testProcess;
+
+    testProcess.stdout.on('data', (data) => {
+      console.log(data.toString('utf8'));
+    });
+    testProcess.stderr.on('data', (data) => {
+      console.log(data.toString('utf8'));
+    });
+
     testProcess.on('close', code => {
       console.log('Finished setting up the repositories. Ready to accept new jobs.');
       runningJob = {};
-- 
GitLab