<?php
// Fetches the probe - a loop, a pipe and a sequence, rendered with four info modes on // and every option of each - and asserts that every mode recorded something for that very // request: not that artifacts exist, but that this fetch grew them. // // The xml report is the exception: each request writes it afresh. A stale tree is left // in its place before the fetch, so afterwards the file has to be one well-formed tree // without it - an engine that stops clearing the report appends to the stale tree and // the two roots no longer parse.
$trackBefore = count ( glob ( DATA . 'track/requests/*' ) ?: [] ); $xmlFile = DATA . '_xml/compact/include/probe.xml'; $dbBefore = (int) padDb ( "field count(*) from track_request" );
padFilePut ( $xmlFile, "<stale />" );
// The xref recorder adds a page to an item's list once and skips it ever after, and the // list is a standing store builds never wipe - so finding the entry proved nothing about // this fetch. It is taken out first, has to come back, and the store is then put back // byte for byte, since git tracks it.
$xrefFile = DATA . 'reference/tag/pad/sequence.txt'; $xrefKeep = file_get_contents ( $xrefFile );
file_put_contents ( $xrefFile, str_replace ( "regression/info;probe\n", '', $xrefKeep ) );
libxml_use_internal_errors ( TRUE );
$r = padCurl ( $padHost . 'regression/info/?probe&padInclude' );
$stats = json_decode ( $r ['headers'] ['PAD-Stats'] ?? '', TRUE );
// The recorders finish after the probe's response has already been flushed back, so the // growth is given a moment to land before it is read.
for ( $settle = 0; $settle < 20; $settle++ ) {
clearstatcache ();
$trackAfter = count ( glob ( DATA . 'track/requests/*' ) ?: [] ); $xmlText = file_exists ( $xmlFile ) ? file_get_contents ( $xmlFile ) : ''; $xmlOne = ! str_contains ( $xmlText, '<stale' ) and simplexml_load_string ( $xmlText ) !== FALSE; $dbAfter = (int) padDb ( "field count(*) from track_request" ); $xref = file_get_contents ( $xrefFile );
if ( $trackAfter > $trackBefore and $xmlOne and $dbAfter > $dbBefore and str_contains ( $xref, 'regression/info;probe' ) ) break;
usleep ( 100000 );
}
file_put_contents ( $xrefFile, $xrefKeep );
// The occurrences page, its report written in full: a loop of fields alone opens no level // inside it, and its two occurrences still belong in its element - the element was written // closed on its own line, and <occurs> after it, read as the parent's.
$occursFile = DATA . '_xml/include/occurs.xml';
padFilePut ( $occursFile, "<stale />" );
padCurl ( $padHost . 'regression/info/?occurs&padInclude' );
for ( $settle = 0; $settle < 20; $settle++ ) {
clearstatcache ();
$occursText = file_exists ( $occursFile ) ? file_get_contents ( $occursFile ) : ''; $occursXml = str_contains ( $occursText, '<stale' ) ? FALSE : simplexml_load_string ( $occursText );
if ( $occursXml !== FALSE ) break;
usleep ( 100000 );
}
$vStats = ( is_array ( $stats ) and isset ( $stats ['total'] ) ) ? 'yes' : 'NO'; $vTrack = ( $trackAfter > $trackBefore and $dbAfter > $dbBefore ) ? 'yes' : 'NO'; $vXml = ( $xmlOne ) ? 'yes' : 'NO'; $vXref = ( str_contains ( $xref, 'regression/info;probe' ) ) ? 'yes' : 'NO'; $vOccur = ( $occursXml !== FALSE and count ( $occursXml->xpath ( '//rows/occurs/occur' ) ) == 2 ) ? 'yes' : 'NO';
?>
|
<p>stats put its timings in the header: <b>{$vStats}</b></p> <p>track filed the request, on disk and in the database: <b>{$vTrack}</b></p> <p>xml wrote one level tree for this request: <b>{$vXml}</b></p> <p>xml wrote the occurrences of a loop inside its element: <b>{$vOccur}</b></p> <p>xref has the probe on record: <b>{$vXref}</b></p>
|
|