Closed Bug 1487244 Opened 6 years ago Closed 6 years ago

Remove mach's --debug-command argument before starting Raptor

Categories

(Testing :: Raptor, enhancement)

enhancement
Not set
normal

Tracking

(firefox63 fixed)

RESOLVED FIXED
mozilla63
Tracking Status
firefox63 --- fixed

People

(Reporter: bc, Assigned: bc)

References

Details

Attachments

(1 file)

mach has a command line argument --debug-command  to start the python debugger when the command is dispatched. This breaks with raptor-test since the --debug-command is passed to raptor's cmdline.py which does not recognize it.
before:

$ ./mach --debug-command raptor-test --test raptor-speedometer --app geckoview --binary org.mozilla.geckoview_example
> /home/bclary/mozilla/builds/inbound-taskcluster/mozilla/testing/raptor/mach_commands.py(165)run_raptor_test()
-> build_obj = MozbuildObject.from_environment(cwd=HERE)
(Pdb) c
...
14:45:39     INFO - Calling [u'/home/bclary/mozilla/builds/inbound-taskcluster/mozilla/fennec-opt-arm/testing/raptor-venv/bin/python', u'/home/bclary/mozilla/builds/inbound-taskcluster/mozilla/testing/raptor/raptor/raptor.py', u'--run-local', u'raptor-test', u'--test', u'raptor-speedometer', u'--app', u'geckoview', u'--binary', u'org.mozilla.geckoview_example', u'--app', u'geckoview', u'--obj-path', u'/home/bclary/mozilla/builds/inbound-taskcluster/mozilla/fennec-opt-arm', u'--log-tbpl-level=debug'] with output_timeout 3600
14:45:39     INFO -  usage: raptor.py [-h] -t TEST [--app {firefox,chrome,geckoview}] [-b BINARY]
14:45:39     INFO -                   [--branchName BRANCH_NAME] [--symbolsPath SYMBOLS_PATH]
14:45:39     INFO -                   [--run-local] [--obj-path OBJ_PATH]
14:45:39     INFO -                   [--log-unittest LOG_UNITTEST] [--log-raw LOG_RAW]
14:45:39     INFO -                   [--log-html LOG_HTML] [--log-tbpl LOG_TBPL]
14:45:39     INFO -                   [--log-xunit LOG_XUNIT] [--log-mach LOG_MACH]
14:45:39     INFO -                   [--log-tbpl-compact] [--log-mach-buffer LOG_MACH_BUFFER]
14:45:39     INFO -                   [--log-tbpl-buffer LOG_TBPL_BUFFER] [--log-mach-verbose]
14:45:39     INFO -                   [--log-mach-level LOG_MACH_LEVEL]
14:45:39     INFO -                   [--log-raw-level LOG_RAW_LEVEL]
14:45:39     INFO -                   [--log-tbpl-level LOG_TBPL_LEVEL]
14:45:39     INFO -  raptor.py: error: unrecognized arguments: raptor-test
14:45:39    ERROR - Return code: 2

after

before:

$ ./mach --debug-command raptor-test --test raptor-speedometer --app geckoview --binary org.mozilla.geckoview_example
> /home/bclary/mozilla/builds/inbound-taskcluster/mozilla/testing/raptor/mach_commands.py(165)run_raptor_test()
-> build_obj = MozbuildObject.from_environment(cwd=HERE)
(Pdb) c
...
14:57:20     INFO -  raptor-control-server shutting down control server
14:57:20     INFO -  raptor-main finished
14:57:20     INFO - Return code: 0
...
Attachment #9005042 - Flags: review?(gbrown)
One question - and perhaps an irrelevant one at that, but wouldn't stripping out --debug-command at raptor/cmdline.py be an approach that doesn't remove mach functionality? Or is ./mach --debug-command not commonly used by users?
Comment on attachment 9005042 [details] [diff] [review]
raptor-remove-debug-command.patch

Review of attachment 9005042 [details] [diff] [review]:
-----------------------------------------------------------------

I think this is okay...but it does feel rather special-case-y. 

I think raptor runs into trouble with --debug-command (unlike most mach commands, hopefully) because it directly accesses sys.argv. I suspect a "better" solution would involve making better use of the mach command decorators, or maybe just add an argparse.REMAINDER arg in cmdline.py and use that instead of sys.argv[2:]? 

Those ideas might run into complications though, and this gets the job done simply...
Attachment #9005042 - Flags: review?(gbrown) → review+
(In reply to Edwin Gao ( :egao ) from comment #2)
> One question - and perhaps an irrelevant one at that, but wouldn't stripping
> out --debug-command at raptor/cmdline.py be an approach that doesn't remove
> mach functionality? Or is ./mach --debug-command not commonly used by users?

It removes it after mach handles it so that it doesn't remove functionality from mach. You can see from the comment with the patch where it stops in the python debugger at the first statement in the mach command...

$ ./mach --debug-command raptor-test --test raptor-speedometer --app geckoview --binary org.mozilla.geckoview_example
> /home/bclary/mozilla/builds/inbound-taskcluster/mozilla/testing/raptor/mach_commands.py(165)run_raptor_test()
-> build_obj = MozbuildObject.from_environment(cwd=HERE)
(Pdb) c

(In reply to Geoff Brown [:gbrown] from comment #3)
> Comment on attachment 9005042 [details] [diff] [review]
> raptor-remove-debug-command.patch
> 
> Review of attachment 9005042 [details] [diff] [review]:
> -----------------------------------------------------------------
> 
> I think this is okay...but it does feel rather special-case-y. 
> 
> I think raptor runs into trouble with --debug-command (unlike most mach
> commands, hopefully) because it directly accesses sys.argv. I suspect a
> "better" solution would involve making better use of the mach command
> decorators, or maybe just add an argparse.REMAINDER arg in cmdline.py and
> use that instead of sys.argv[2:]? 
> 
> Those ideas might run into complications though, and this gets the job done
> simply...

Yeah, it basically comes down to the way raptor handles its arguments as a list rather than parsing them. Changing that would cause a cascade of other changes. I looked into that initially but it was a can of worms I didn't want to open. I think a good follow up would be to figure out a better way for this and for raptor to deal with its arguments. We can take it up with rwood next week.

Thanks!
Pushed by bclary@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/57e362dbff45
Remove mach's --debug-command argument before starting Raptor, r=gbrown.
https://hg.mozilla.org/mozilla-central/rev/57e362dbff45
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla63
Blocks: 1483695
See Also: → 1680194
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: