From: Rudolf Polzer Date: Fri, 26 Nov 2010 11:55:47 +0000 (+0100) Subject: the test case script X-Git-Tag: xonotic-v0.1.0preview~29 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=beeb6e65e4e26410d2c09dda654f8362ed5d6edf;p=xonotic%2Fxonotic.git the test case script --- diff --git a/misc/infrastructure/php/d0_blind_id.inc b/misc/infrastructure/php/d0_blind_id.inc new file mode 100644 index 00000000..ff35e952 --- /dev/null +++ b/misc/infrastructure/php/d0_blind_id.inc @@ -0,0 +1,103 @@ + array("pipe", "w"), + 3 => array("file", $d0_blind_id_d0pk, "r"), + 4 => array("pipe", "r"), + 5 => array("pipe", "r") + ), + $pipes, + null, + null, + array("binary_pipes") + ); + if(!$checker) + die("Cannot start process"); + $outfh = $pipes[1]; + $buffers = array( + 4 => $postdata, + 5 => base64_decode($sig) + ); + $rpipes = array( + 4 => $pipes[4], + 5 => $pipes[5] + ); + foreach($rpipes as $p) + stream_set_blocking($p, 0); + while(!empty($rpipes)) + { + $readers = null; + $writers = $rpipes; + $errorers = $rpipes; + $n = stream_select($readers, $writers, $errorers, 1, 0); + if($n == 0) + break; + $n = 0; + foreach($errorers as $e) + { + $i = array_search($e, $rpipes); + if($i === false) + continue; + fclose($pipes[$i]); + unset($buffers[$i]); + unset($rpipes[$i]); + ++$n; + } + foreach($writers as $w) + { + $i = array_search($w, $rpipes); + if($i === false) + continue; + $written = fwrite($w, $buffers[$i], strlen($buffers[$i])); + if($written) + $buffers[$i] = substr($buffers[$i], $written); + if($buffers[$i] == "") + { + fclose($pipes[$i]); + unset($buffers[$i]); + unset($rpipes[$i]); + } + ++$n; + } + if(!$n) + break; + } + if($buffers) + die("could not write data to process"); + $status = stream_get_line($outfh, 8192, "\n"); + $idfp = stream_get_line($outfh, 8192, "\n"); + $ret = proc_close($checker); + if($ret != 0) + return array(null, null); + return array($idfp, $status); + } + else + return array("", 0); +} +?> diff --git a/misc/infrastructure/php/d0_blind_id_test.php b/misc/infrastructure/php/d0_blind_id_test.php new file mode 100644 index 00000000..9d233d1a --- /dev/null +++ b/misc/infrastructure/php/d0_blind_id_test.php @@ -0,0 +1,24 @@ +