<?php

/**
 * Harness for the "psstatus_plugin" autopkgtest: print the phpSysInfo XML with
 * the PSStatus plugin enabled. Unlike the hermetic unit tests this does NOT use
 * PSI_ROOTFS, so executeProgram() runs for real and the plugin actually calls
 * pidof(1) against the live process table.
 *
 * Usage: php psstatus-webpage.php <config.ini>
 */

if ($argc < 2) {
    fwrite(STDERR, "usage: psstatus-webpage.php <config.ini>\n");
    exit(2);
}

// Installed package lives in /usr/share/phpsysinfo (bootstrap default); allow
// an override so the test can run against a source checkout.
$root = getenv('PSI_APP_ROOT');
if ($root !== false && $root !== '') {
    define('PSI_APP_ROOT', $root);
}

define('PSI_CONFIG_FILE_PATH', $argv[1]);
// Opt out of the captured filesystem: we want the real pidof/pgrep to run.
define('PSI_ROOTFS', '');

require __DIR__ . '/bootstrap-autopkgtests.php';

$webpage = new WebpageXML("complete");
echo $webpage->getXMLString();
