From 4c7104e882520946c14204d9a8dfa97b669d4c8d Mon Sep 17 00:00:00 2001 From: darin Date: Wed, 24 Oct 2007 07:41:45 +0000 Subject: [PATCH] Reviewed by Eric. * sunspider: Open the profile in shark after completing a run. * sunspider-compare-results: Tiny perl tweaks. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@26954 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- SunSpider/ChangeLog | 7 +++++++ SunSpider/sunspider | 31 +++++++++++++++++++---------- SunSpider/sunspider-compare-results | 6 ++---- 3 files changed, 30 insertions(+), 14 deletions(-) diff --git a/SunSpider/ChangeLog b/SunSpider/ChangeLog index 4a2baf7483a1..e68b1549d024 100644 --- a/SunSpider/ChangeLog +++ b/SunSpider/ChangeLog @@ -1,3 +1,10 @@ +2007-10-24 Darin Adler + + Reviewed by Eric. + + * sunspider: Open the profile in shark after completing a run. + * sunspider-compare-results: Tiny perl tweaks. + 2007-10-23 Maciej Stachowiak Reviewed by Darin. diff --git a/SunSpider/sunspider b/SunSpider/sunspider index 22eda609e5ec..70d7210345a1 100755 --- a/SunSpider/sunspider +++ b/SunSpider/sunspider @@ -1,7 +1,7 @@ #!/usr/bin/perl -w -# Copyright (C) 2007 Apple Inc. All rights reserved. -# Copyright (C) Eric Seidel +# Copyright (C) 2007 Apple Inc. All rights reserved. +# Copyright (C) 2007 Eric Seidel # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -61,7 +61,7 @@ if (!$jsShellPath || $showHelp) { sub dumpToFile($$) { my ($contents, $path) = @_; - open FILE, ">$path"; + open FILE, ">", $path or die; print FILE $contents; close FILE; } @@ -73,7 +73,7 @@ my %uniqueCategories = (); sub loadTestsList() { - open TESTLIST, "<./tests/LIST"; + open TESTLIST, "<", "tests/LIST" or die; while () { chomp; next unless !$testsPattern || /$testsPattern/; @@ -104,8 +104,6 @@ sub runTestsOnce($) my $shellArgs = "-f tmp/sunspider-test-prefix.js -f resources/sunspider-standalone-driver.js 2> /dev/null"; my $output; if ($useShark) { - print STDERR "Running sunspider under Shark... (this will take a while)\n"; - print STDERR "shark -i -1 -q \"$jsShellPath\" $shellArgs\n"; $output = `shark -i -1 -q "$jsShellPath" $shellArgs`; } else { $output = `"$jsShellPath" $shellArgs | grep -v break`; @@ -113,8 +111,6 @@ sub runTestsOnce($) return $output; } - - loadTestsList(); if ($testsPattern) { print STDERR "Found " . scalar(@tests) . " tests matching '" . $testsPattern . "'\n"; @@ -122,7 +118,7 @@ if ($testsPattern) { print STDERR "Found " . scalar(@tests) . " tests\n"; } die "No tests to run" unless scalar(@tests); -print STDERR "Running SunSpider once for warmup, then $testRuns times\n"; +print STDERR "Running SunSpider once for warmup, then $testRuns time" . ($testRuns == 1 ? "" : "s") . ($runShark ? " under Shark" : "") . "\n"; writePrefixFile(); runTestsOnce(0); @@ -147,4 +143,19 @@ dumpToFile($output, "tmp/sunspider-results.js"); system("$jsShellPath", "-f", "tmp/sunspider-test-prefix.js", "-f", "tmp/sunspider-results.js", "-f", "resources/sunspider-analyze-results.js"); -print STDERR "Shark sessions can be found in " . getcwd() . "\n" if $runShark; +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; + exec "/usr/bin/open", $newestMShark if $newestMShark; +} diff --git a/SunSpider/sunspider-compare-results b/SunSpider/sunspider-compare-results index 218c3940b274..b88292453a77 100755 --- a/SunSpider/sunspider-compare-results +++ b/SunSpider/sunspider-compare-results @@ -48,7 +48,7 @@ if (scalar @ARGV < 2 || !$jsShellPath || $showHelp) { sub readResultsFile($) { my ($filename) = @_; - open FILE, "<${filename}"; + open FILE, "<", $filename or die; my $foundStart = 0; my $foundEnd = 0; my $result = ""; @@ -79,7 +79,7 @@ sub readResultsFile($) sub dumpToFile($$) { my ($contents, $path) = @_; - open FILE, ">$path"; + open FILE, ">", $path or die; print FILE $contents; close FILE; } @@ -90,5 +90,3 @@ $output .= "var output2 = " . readResultsFile($ARGV[1]) . ";\n"; dumpToFile($output, "tmp/sunspider-comparison-data.js"); system("$jsShellPath", "-f", "tmp/sunspider-test-prefix.js", "-f", "tmp/sunspider-comparison-data.js", "-f", "resources/sunspider-compare-results.js"); - - -- 2.36.0