Bug 93233 - [Chromium]duplicated command line options in Android LayoutTest
Summary: [Chromium]duplicated command line options in Android LayoutTest
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: Wei James (wistoch)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-08-06 01:36 PDT by Wei James (wistoch)
Modified: 2012-08-06 22:48 PDT (History)
7 users (show)

See Also:


Attachments
Patch (2.11 KB, patch)
2012-08-06 01:40 PDT, Wei James (wistoch)
no flags Details | Formatted Diff | Diff
Patch (2.12 KB, patch)
2012-08-06 01:56 PDT, Wei James (wistoch)
no flags Details | Formatted Diff | Diff
Patch (5.46 KB, patch)
2012-08-06 20:28 PDT, Wei James (wistoch)
no flags Details | Formatted Diff | Diff
Patch (5.81 KB, patch)
2012-08-06 21:46 PDT, Wei James (wistoch)
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Wei James (wistoch) 2012-08-06 01:36:42 PDT
[Chromium]duplicated command line options in Android LayoutTest
Comment 1 Wei James (wistoch) 2012-08-06 01:40:07 PDT
Created attachment 156622 [details]
Patch
Comment 2 WebKit Review Bot 2012-08-06 01:42:56 PDT
Attachment 156622 [details] did not pass style-queue:

Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Tools/ChangeLog', u'Tools/Scripts/webkitpy..." exit_code: 1
Tools/ChangeLog:11:  Line contains tab character.  [whitespace/tab] [5]
Total errors found: 1 in 2 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 3 Wei James (wistoch) 2012-08-06 01:56:06 PDT
Created attachment 156626 [details]
Patch
Comment 4 Tony Chang 2012-08-06 02:17:15 PDT
Comment on attachment 156626 [details]
Patch

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

Seems fine, but should we add a unit test for this?

> Tools/ChangeLog:12
> +        If there are multiple ChromiumAndroidPort instances, these two options
> +        will be appended for multiple times.

Do we normally have multiple ChromiumAndroidPort instances?  Does having these options multiple times cause anything to break?
Comment 5 Wei James (wistoch) 2012-08-06 02:34:14 PDT
(In reply to comment #4)
> (From update of attachment 156626 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=156626&action=review
> 
> Seems fine, but should we add a unit test for this?
> 
ok. I will add an unit test for it. 
> > Tools/ChangeLog:12
> > +        If there are multiple ChromiumAndroidPort instances, these two options
> > +        will be appended for multiple times.
> 
> Do we normally have multiple ChromiumAndroidPort instances?  Does having these options multiple times cause anything to break?

when I tried chromium android layout test, there are actually two ChromiumAndroidPort instances. So the command line contains two copies of "--encode-binary" and "--enable-hardware-gpu". 

I have not found anything broken by it but just feel odd to have multiple same options in the file chrome-native-tests-command-line.
Comment 6 Xianzhu Wang 2012-08-06 09:08:58 PDT
Comment on attachment 156626 [details]
Patch

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

>>> Tools/ChangeLog:12
>>> +        will be appended for multiple times.
>> 
>> Do we normally have multiple ChromiumAndroidPort instances?  Does having these options multiple times cause anything to break?
> 
> when I tried chromium android layout test, there are actually two ChromiumAndroidPort instances. So the command line contains two copies of "--encode-binary" and "--enable-hardware-gpu". 
> 
> I have not found anything broken by it but just feel odd to have multiple same options in the file chrome-native-tests-command-line.

Just curious, do you know where the two instances are created and why they share the same self._options.additional_drt_flags?
Comment 7 Wei James (wistoch) 2012-08-06 17:58:13 PDT
(In reply to comment #6)
> (From update of attachment 156626 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=156626&action=review
> 
> >>> Tools/ChangeLog:12
> >>> +        will be appended for multiple times.
> >> 
> >> Do we normally have multiple ChromiumAndroidPort instances?  Does having these options multiple times cause anything to break?
> > 
> > when I tried chromium android layout test, there are actually two ChromiumAndroidPort instances. So the command line contains two copies of "--encode-binary" and "--enable-hardware-gpu". 
> > 
> > I have not found anything broken by it but just feel odd to have multiple same options in the file chrome-native-tests-command-line.
> 
> Just curious, do you know where the two instances are created and why they share the same self._options.additional_drt_flags?

the call stack of the first one:
1. run_webkit_tests.py line 468, in main
   port = host.port_factory.get(options.platform, options)
2. factory.py line 114  
   return cls(self._host, port_name, options=options, **kwargs)
3. chromium_android.py __init__

the call stack of the second one:
1. run_webkit_tests.py line 110, in run
      unexpected_result_count = manager.run(args)
2. manager.py line 418, in run
      self._run_tests(self._test_names, result_summary, int(self._options.child_processes))
3. manager.py line 471, in _run_tests
      return self._runner.run_tests(test_inputs, self._expectations, result_summary, num_workers, needs_http, needs_websockets, self._retrying)
4. layout_test_runner.py line 140, in run_tests
      pool.run(('test_list', shard.name, shard.test_inputs) for shard in all_shards)
5. message_pool.py line 97, in run
      self.wait()
6. message_pool.py line 127, in wait
      self._workers[0].run()
7. message_pool.py line 267, in run
      self._raise(sys.exc_info())
8. message_pool.py line 251, in run
      worker.start()
9. layout_test_runner.py line 293, in start
      self._port = self._host.port_factory.get(self._options.platform, self._options)
10. factory.py line 114, in get
      return cls(self._host, port_name, options=options, **kwargs)
11. chromium_android.py  __init__


they have the same options argument from main() of run_webkit_tests.py.
Comment 8 Wei James (wistoch) 2012-08-06 18:06:04 PDT
will it make more sense to make the port instance singleton? 

that is, in factory.py, get() function can store the instance and return it when others call get() for the instance for the same port-name. 

but I don't know whether such chagne will break anything.
Comment 9 Tony Chang 2012-08-06 18:59:29 PDT
Another approach would be to not mutate options.additional_drt_flag.  E.g., in driver.py's cmd_line, in addition to using _port.get_option('aditional_drt_flag', ...), we could add a _port.additional_drt_flag() method.

Dirk, thoughts?
Comment 10 Dirk Pranke 2012-08-06 19:11:55 PDT
(In reply to comment #9)
> Another approach would be to not mutate options.additional_drt_flag.  E.g., in driver.py's cmd_line, in addition to using _port.get_option('aditional_drt_flag', ...), we could add a _port.additional_drt_flag() method.
> 
> Dirk, thoughts?

That might be slightly better. It's probably a flaw to be mutating the options argument in the port classes, but the assumption that we can do that pervades the code at the moment.
Comment 11 Wei James (wistoch) 2012-08-06 20:28:00 PDT
Created attachment 156848 [details]
Patch
Comment 12 Wei James (wistoch) 2012-08-06 20:29:46 PDT
tony, 

I have modified the patch to use your approach and added an unit test.

could you help to review the new patch? thanks
Comment 13 Tony Chang 2012-08-06 20:32:51 PDT
Comment on attachment 156848 [details]
Patch

Can you rebase your change against HEAD?
Comment 14 Wei James (wistoch) 2012-08-06 21:46:21 PDT
Created attachment 156858 [details]
Patch
Comment 15 WebKit Review Bot 2012-08-06 22:47:58 PDT
Comment on attachment 156858 [details]
Patch

Clearing flags on attachment: 156858

Committed r124851: <http://trac.webkit.org/changeset/124851>
Comment 16 WebKit Review Bot 2012-08-06 22:48:03 PDT
All reviewed patches have been landed.  Closing bug.