Announcement

Collapse
No announcement yet.

Patch for pts-functions-run bug

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Patch for pts-functions-run bug

    This fixes a bug in the pts_run_benchmark function which passes the default arguments twice to global comparisons. This affected the warsow test particularly badly as it prevented it from running from a global comparison.

    This bug is caused by the uploaded test result containing both the default and extra arguments. When a comparison is made, these are added back to the default arguments for the test, resulting in two sets of default arguments and one set of extra arguments.

    This patch removes the default arguments from the downloaded comparison file. However, if the default arguments for a test are ever changed, this will break. A more significant patch could be applied that would simply not apply a test's default arguments when running a global comparison, but would require more extensive modification of other parts of pts (as the pts_run_benchmark function doesn't know what test-type it's running).

    Anyway, the patch:

    Code:
    diff --git a/pts-core/functions/pts-functions-run.php b/pts-core/functions/pts-functions-run.php
    index ee924cc..ce7c580 100644
    --- a/pts-core/functions/pts-functions-run.php
    +++ b/pts-core/functions/pts-functions-run.php
    @@ -306,7 +306,7 @@ function pts_run_benchmark($benchmark_identifier, $extra_arguments = "", $argume
                    //pts_install_benchmark($benchmark_identifier);
            }
    
    -       $PTS_BENCHMARK_ARGUMENTS = trim($default_arguments . " " . $extra_arguments);
    +       $PTS_BENCHMARK_ARGUMENTS = trim($default_arguments . " " . str_replace($default_arguments, "", $extra_arguments));
            $BENCHMARK_RESULTS_ARRAY = array();
    
            if(is_file(TEST_RESOURCE_DIR . $benchmark_identifier . "/pre.sh"))

  • #2
    In git, thanks. I didn't catch that bug yet.
    Michael Larabel
    https://www.michaellarabel.com/

    Comment

    Working...
    X