Bug 104298 - change --no-launch-safari to --no-show-results in scripts
Summary: change --no-launch-safari to --no-show-results in scripts
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Dirk Pranke
URL:
Keywords:
Depends on: 104601
Blocks: 104299 104301
  Show dependency treegraph
 
Reported: 2012-12-06 14:04 PST by Dirk Pranke
Modified: 2012-12-10 18:01 PST (History)
8 users (show)

See Also:


Attachments
Patch (7.27 KB, patch)
2012-12-06 14:06 PST, Dirk Pranke
no flags Details | Formatted Diff | Diff
rework to just pass --no-show-results to ORWT (6.32 KB, patch)
2012-12-10 15:17 PST, Dirk Pranke
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dirk Pranke 2012-12-06 14:04:05 PST
change --no-launch-safari to --no-show-results in scripts
Comment 1 Dirk Pranke 2012-12-06 14:06:30 PST
Created attachment 178078 [details]
Patch
Comment 2 Eric Seidel (no email) 2012-12-06 15:25:35 PST
Comment on attachment 178078 [details]
Patch

Looks reasonable.
Comment 3 Daniel Bates 2012-12-07 00:00:26 PST
Comment on attachment 178078 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=178078&action=review

> Tools/ChangeLog:13
> +        for ORWT (I didn't modify ORWT itself because making the arg parsing
> +        work turned out to be pretty awkward).

(*) Can you elaborate on the awkwardness?

> Tools/Scripts/run-webkit-tests:102
> +    if (grep(/--no-show-results/, @ARGV)) {
> +        push(@ARGV, "--no-launch-safari");
> +        @ARGV = grep { $_ ne "--no-show-results" } @ARGV;
> +    }

Assuming we take the approach of substituting --[no-]launch-safari for --[no-]show-results (see my question (*) above), I suggest that we take advantage of the convenience function webkitdirs::checkForArgumentAndRemoveFromARGV() instead of implementing similar functionality. As its name implies, webkitdirs::checkForArgumentAndRemoveFromARGV() checks for the presence of the specified command line argument and removes it if present. The function returns true if the argument was in the list of command line arguments; otherwise, it returns false. Simplifying this code using webkitdirs::checkForArgumentAndRemoveFromARGV(), we have:

push(@ARGV, "--no-launch-safari") if checkForArgumentAndRemoveFromARGV("--no-show-results");

> Tools/Scripts/run-webkit-tests:106
> +    if (grep(/--show-results/, @ARGV)) {
> +        push(@ARGV, "--launch-safari");
> +        @ARGV = grep { $_ ne "--show-results" } @ARGV;
> +    }

Assuming we take the approach of substituting --[no-]-launch-safari for --[no-]show-results (see my question (*) above), we can similarly write this using webkitdirs::checkForArgumentAndRemoveFromARGV() as:

push(@ARGV, "--launch-safari") if checkForArgumentAndRemoveFromARGV("--show-results");
Comment 4 Dirk Pranke 2012-12-07 09:01:21 PST
(In reply to comment #3)
> (From update of attachment 178078 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=178078&action=review
> 
> > Tools/ChangeLog:13
> > +        for ORWT (I didn't modify ORWT itself because making the arg parsing
> > +        work turned out to be pretty awkward).
> 
> (*) Can you elaborate on the awkwardness?
> 

I wasn't sure if you meant here or in the ChangeLog, but when I initially looked at the perl arg-parsing code I didn't see a way to easily make one option an alias for another, and since we displayed the default values for --launch-safari as well it looked like it was going to take a bunch of searching-and-replacing in multiple locations to make things work. However, I just re-checked the Getopt::Long perldoc and it looks like you can define a custom subroutine to make the args aliases, so I'll try that and if it works push all of this down into old-run-webkit-tests so we don't need to do the substitution any more.

Failing all that, your suggestion below sounds fine.

> > Tools/Scripts/run-webkit-tests:102
> > +    if (grep(/--no-show-results/, @ARGV)) {
> > +        push(@ARGV, "--no-launch-safari");
> > +        @ARGV = grep { $_ ne "--no-show-results" } @ARGV;
> > +    }
> 
> Assuming we take the approach of substituting --[no-]launch-safari for --[no-]show-results (see my question (*) above), I suggest that we take advantage of the convenience function webkitdirs::checkForArgumentAndRemoveFromARGV() instead of implementing similar functionality. As its name implies, webkitdirs::checkForArgumentAndRemoveFromARGV() checks for the presence of the specified command line argument and removes it if present. The function returns true if the argument was in the list of command line arguments; otherwise, it returns false. Simplifying this code using webkitdirs::checkForArgumentAndRemoveFromARGV(), we have:
> 
> push(@ARGV, "--no-launch-safari") if checkForArgumentAndRemoveFromARGV("--no-show-results");
> 
> > Tools/Scripts/run-webkit-tests:106
> > +    if (grep(/--show-results/, @ARGV)) {
> > +        push(@ARGV, "--launch-safari");
> > +        @ARGV = grep { $_ ne "--show-results" } @ARGV;
> > +    }
> 
> Assuming we take the approach of substituting --[no-]-launch-safari for --[no-]show-results (see my question (*) above), we can similarly write this using webkitdirs::checkForArgumentAndRemoveFromARGV() as:
> 
> push(@ARGV, "--launch-safari") if checkForArgumentAndRemoveFromARGV("--show-results");
Comment 5 Dirk Pranke 2012-12-10 15:17:43 PST
Created attachment 178643 [details]
rework to just pass --no-show-results to ORWT
Comment 6 Dirk Pranke 2012-12-10 15:19:43 PST
new patch, much simpler ...
Comment 7 Eric Seidel (no email) 2012-12-10 15:28:37 PST
Comment on attachment 178643 [details]
rework to just pass --no-show-results to ORWT

OK.
Comment 8 WebKit Review Bot 2012-12-10 18:01:25 PST
Comment on attachment 178643 [details]
rework to just pass --no-show-results to ORWT

Clearing flags on attachment: 178643

Committed r137237: <http://trac.webkit.org/changeset/137237>
Comment 9 WebKit Review Bot 2012-12-10 18:01:30 PST
All reviewed patches have been landed.  Closing bug.