Reviewed by Maciej.
* sunspider: Added a "--base" option that records the current test as a baseline.
Moved the code to find the newest .mshark file into a function (since I needed to use
it in the other script and I prefer to copy/paste a function).
* sunspider-compare-results: Added logic to compare the baseline with the last
run when you don't pass any parameters.
WebKitTools:
Reviewed by Maciej.
* Scripts/run-sunspider: Pass the "--base" option through.
* Scripts/sunspider-compare-results: Don't check the number of parameters; let
the real script do that. Default configuration to Release to match run-sunspider
so we don't end up building Debug just to compare results.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@27382
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2007-11-02 Darin Adler <darin@apple.com>
+
+ Reviewed by Maciej.
+
+ * sunspider: Added a "--base" option that records the current test as a baseline.
+ Moved the code to find the newest .mshark file into a function (since I needed to use
+ it in the other script and I prefer to copy/paste a function).
+
+ * sunspider-compare-results: Added logic to compare the baseline with the last
+ run when you don't pass any parameters.
+
2007-10-29 Maciej Stachowiak <mjs@apple.com>
Reviewed by Eric.
use strict;
use Getopt::Long;
use File::Basename;
+use File::Spec;
use Cwd;
use POSIX qw(strftime);
my $runShark = 0;
my $runShark20 = 0;
my $jsShellPath;
+my $setBase = 0;
my $testsPattern;
my $testRuns = 5; # This number may be different from what ./sunspider defaults to (that's OK)
my $usage = <<EOF;
Usage: $programName --shell=[path] [options]
--help Show this help message
+ --base Set baseline for future comparisons
--shell Path to JavaScript shell
--runs Number of times to run tests (default: $testRuns)
--tests Only run tests matching provided pattern
--shark20 Like --shark, but with a 20 microsecond sampling interval
EOF
-GetOptions('runs=i' => \$testRuns,
+GetOptions('base' => \$setBase,
+ 'runs=i' => \$testRuns,
'shell=s' => \$jsShellPath,
'shark' => \$runShark,
'shark20' => \$runShark20,
return $output;
}
+sub newestFile($$)
+{
+ my ($dir, $pattern) = @_;
+
+ my $newestAge;
+ my $newestFile = "";
+ opendir DIR, $dir or die;
+ for my $file (readdir DIR) {
+ if ($file =~ $pattern) {
+ my $age = -M "$dir/$file";
+ if (!defined $newestAge || $age < $newestAge) {
+ $newestFile = $file;
+ $newestAge = $age;
+ }
+ }
+ }
+ closedir DIR;
+
+ return "$dir/$newestFile";
+}
+
loadTestsList();
if ($testsPattern) {
print STDERR "Found " . scalar(@tests) . " tests matching '" . $testsPattern . "'\n";
my $output = "var output = [\n" . join(",\n", @results) . "\n];\n";
dumpToFile($output, $resultsFile);
+dumpToFile(File::Spec->rel2abs($resultsFile), "tmp/baseline-filename.txt") if $setBase;
system("$jsShellPath", "-f", $prefixFile, "-f", $resultsFile, "-f", "resources/sunspider-analyze-results.js");
if ($runShark) {
- my $newestAge = 0;
- my $newestMShark = 0;
- opendir DIR, "." or die;
- for my $file (readdir DIR) {
- if ($file =~ /\.mshark$/) {
- my $age = -M $file;
- if ($age < $newestAge) {
- $newestMShark = $file;
- $newestAge = $age;
- }
- }
- }
- closedir DIR;
+ my $newestMShark = newestFile(".", qr/\.mshark$/);
if ($newestMShark) {
my $profileFile = "tmp/sunspider-profile-$timeString.mshark";
rename $newestMShark, $profileFile or die;
GetOptions('shell=s' => \$jsShellPath,
'help' => \$showHelp);
-if (scalar @ARGV < 2 || !$jsShellPath || $showHelp) {
+if ((scalar @ARGV != 0 && scalar @ARGV != 2) || !$jsShellPath || $showHelp) {
print STDERR $usage;
exit 1;
}
close FILE;
}
-my $output = "var output1 = " . readResultsFile($ARGV[0]) . ";\n";
-$output .= "var output2 = " . readResultsFile($ARGV[1]) . ";\n";
+sub readFile($)
+{
+ my ($path) = @_;
+ open FILE, "<", $path or die;
+ my $result = <FILE>;
+ close FILE;
+ return $result;
+}
+
+sub newestFile($$)
+{
+ my ($dir, $pattern) = @_;
+
+ my $newestAge;
+ my $newestFile = "";
+ opendir DIR, $dir or die;
+ for my $file (readdir DIR) {
+ if ($file =~ $pattern) {
+ my $age = -M "$dir/$file";
+ if (!defined $newestAge || $age < $newestAge) {
+ $newestFile = $file;
+ $newestAge = $age;
+ }
+ }
+ }
+ closedir DIR;
+
+ return "$dir/$newestFile";
+}
+
+my $file1;
+my $file2;
+
+if (scalar @ARGV == 2) {
+ $file1 = $ARGV[0];
+ $file2 = $ARGV[1];
+} else {
+ $file1 = readFile("tmp/baseline-filename.txt");
+ $file2 = newestFile("tmp", qr/sunspider-results-.+\.js$/);
+}
+
+my $output = "var output1 = " . readResultsFile($file1) . ";\n";
+$output .= "var output2 = " . readResultsFile($file2) . ";\n";
dumpToFile($output, "tmp/sunspider-comparison-data.js");
+2007-11-02 Darin Adler <darin@apple.com>
+
+ Reviewed by Maciej.
+
+ * Scripts/run-sunspider: Pass the "--base" option through.
+
+ * Scripts/sunspider-compare-results: Don't check the number of parameters; let
+ the real script do that. Default configuration to Release to match run-sunspider
+ so we don't end up building Debug just to compare results.
+
2007-11-01 Adam Roben <aroben@apple.com>
Make changes in WebKit/win show up under "WebKit/win:" instead of just "win:"
my $testRuns = 5; # This number may be different from what sunspider defaults to (that's OK)
my $runShark = 0;
my $runShark20 = 0;
+my $setBase = 0;
my $showHelp = 0;
my $testsPattern;
my $usage = <<EOF;
Usage: $programName [options] [options to pass to build system]
--help Show this help message
+ --base Set baseline for future comparisons
--root Path to root tools build
--runs Number of times to run tests (default: $testRuns)
--tests Only run tests matching provided pattern
--shark20 Like --shark, but with a 20 microsecond sampling interval
EOF
-GetOptions('root=s' => sub { my ($argName, $value); setConfigurationProductDir(Cwd::abs_path($value)); },
+GetOptions('base' => \$setBase,
+ 'root=s' => sub { my ($argName, $value); setConfigurationProductDir(Cwd::abs_path($value)); },
'runs=i' => \$testRuns,
'shark' => \$runShark,
'shark20' => \$runShark20,
# This code could be removed if we chose to pass extra args to sunspider instead of Xcode
push @args, "--shark" if $runShark;
push @args, "--shark20" if $runShark20;
+push @args, "--base" if $setBase;
push @args, "--tests", $testsPattern if $testsPattern;
exec "./sunspider", @args;
#!/usr/bin/perl -w
-# Copyright (C) 2007 Apple Inc. All rights reserved.
+# Copyright (C) 2007 Apple Inc. All rights reserved.
# Copyright (C) 2007 Eric Seidel <eric@webkit.org>
#
# Redistribution and use in source and binary forms, with or without
use webkitdirs;
use POSIX;
-# determine configuration
+# determine configuration, but default to "Release" instead of last-used configuration to match run-sunspider
+setConfiguration("Release");
setConfiguration();
my $configuration = configuration();
GetOptions('root=s' => sub { my ($argName, $value); setConfigurationProductDir(Cwd::abs_path($value)); },
'help' => \$showHelp);
-if ($showHelp || scalar @ARGV < 2) {
+if ($showHelp) {
print STDERR $usage;
exit 1;
}