Commit 8f709720 authored by Daniel Smith's avatar Daniel Smith

Fix escaping of file path for custom benchmarks

parent 9d5eee9d
......@@ -348,12 +348,13 @@ function runTest(test) {
// Set arguments for regressionfinder.py to really do the build and run the test
var args = [];
var re = /\\/gi; //pass forward slashes, even on windows to avoid broken escaping.
if (test.testType == 'bisect'){
args = [].concat(['./regressionFinder.py', '--branch', test.branch, '--moduleToTest', test.module, '--knownBadRev', test.bad_commit,
'--knownGoodRev', test.good_commit, '--benchmark', test.test_name || test.custom_benchmark_file.tempFilePath, '--regressionTarget', test.expected_regression, '--buildCores', buildCores || os.cpus().length]);
'--knownGoodRev', test.good_commit, '--benchmark', test.test_name || test.custom_benchmark_file.tempFilePath.replace(re, "/"), '--regressionTarget', test.expected_regression, '--buildCores', buildCores || os.cpus().length]);
} else if (test.testType == 'singleCommit'){
args = [].concat(['./regressionFinder.py', '--branch', test.branch, '--moduleToTest', test.module, '--testSingleCommit', test.commit,
'--benchmark', test.test_name || test.custom_benchmark_file.tempFilePath, '--buildCores', buildCores || os.cpus().length]);
'--benchmark', test.test_name || test.custom_benchmark_file.tempFilePath.replace(re, "/"), '--buildCores', buildCores || os.cpus().length]);
if (test.firstCommitBuildOnHead){
args.push('--FirstBuildOnHead');
}
......@@ -450,16 +451,16 @@ function runTest(test) {
test.status = 'cancelled';
}
// if(test.custom_benchmark_file){
// if(test.custom_benchmark_file.tempFilePath){
// (async () => {
// var re = /\\/gi;
// // can't use path.normalize here. del@5.0.0 module doesn't seem to work with windows style paths at the moment.
// const deletedPaths = await del([pathmodule.dirname(test.custom_benchmark_file.tempFilePath).replace(re, "/")], {force: true});
// console.log('Deleted files and directories:\n', deletedPaths.join('\n'));
// })(error => {console.log(error)});
// }
// }
if(test.custom_benchmark_file){
if(test.custom_benchmark_file.tempFilePath){
(async () => {
var re = /\\/gi;
// can't use path.normalize here. del@5.0.0 module doesn't seem to work with windows style paths at the moment.
const deletedPaths = await del([pathmodule.dirname(test.custom_benchmark_file.tempFilePath).replace(re, "/")], {force: true});
console.log('Deleted files and directories:\n', deletedPaths.join('\n'));
})(error => {console.log(error)});
}
}
notifyJob.emit('JobDone'); // Emit the JobDone signal to do some more tasks and prep for the next job in queue.
......@@ -596,7 +597,9 @@ function scheduleJobRequest(req, res){
if (req.body.test_hosts[i] == myname){
// Either we're a remote host and received a job, or we're the scheduler and have a job thread available.
console.log('executing test locally.');
job.custom_benchmark_file['tempFilePath'] = tempWrite.sync(job.custom_benchmark_file.data, `${job.custom_benchmark_file.name}`);
if (job.custom_benchmark_file){
job.custom_benchmark_file['tempFilePath'] = tempWrite.sync(job.custom_benchmark_file.data, `${job.custom_benchmark_file.name}`);
}
const jobHash = JSum.digest(job, 'SHA256', 'hex'); // Create a unique hash for this job
console.log(`Hash for this job: ${jobHash}`);
job['jobHash'] = jobHash;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment