From 1e152059e17a50f95d739cdcf22dc499bb3ec7ad Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Thu, 13 Dec 2018 08:08:55 +0100 Subject: [PATCH] use php script, get rid of python for test suite --- scripts/upload_validation.php | 45 +++++++++++++++++++++ src/tests/config/upload_validation_real.ini | 2 +- 2 files changed, 46 insertions(+), 1 deletion(-) create mode 100755 scripts/upload_validation.php diff --git a/scripts/upload_validation.php b/scripts/upload_validation.php new file mode 100755 index 0000000..71f83e6 --- /dev/null +++ b/scripts/upload_validation.php @@ -0,0 +1,45 @@ +#!/usr/bin/env php +&1', + ]; + exec(implode(' ', $cmd), $out, $ret); + if ($ret) { + printf("Error: %d\n", $ret); + return 2; + } + foreach($out as $line) { + $sp = explode('@', $line); + if (count($sp) < 5) { + continue; + } + $opcode = $sp[4]; // # ,line, #, EIO, op, fetch, ext, return, operands + if ($opcode && !in_array($opcode, $whitelist)) { + printf("Upload_validation: Found an opcode: %s\n", $opcode); + return 1; + } + } + return 0; +} + +if ($_SERVER['argc'] != 2) { + die("Usage: {$_SERVER['argv']['0']} file_to_test.php\n"); +} +exit(check($_SERVER['argv']['1'])); + diff --git a/src/tests/config/upload_validation_real.ini b/src/tests/config/upload_validation_real.ini index 6463466..690e9bf 100644 --- a/src/tests/config/upload_validation_real.ini +++ b/src/tests/config/upload_validation_real.ini @@ -1 +1 @@ -sp.upload_validation.script("../scripts/upload_validation.py").enable(); +sp.upload_validation.script("../scripts/upload_validation.php").enable();