Closed Bug 1214152 Opened 9 years ago Closed 9 years ago

Test runner: print suitable error if handed a non-executable

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla45
Tracking Status
firefox45 --- fixed

People

(Reporter: lth, Assigned: lth)

Details

Attachments

(1 file, 2 obsolete files)

Currently, if the required argument to jit_test.py and jstests.py is not an executable, the test harness will try to execute it once for each test, and print one stack trace for each test.  This is usually extremely confusing.  A better solution would be to check that the program is executable, and to fail with an error message if it is not.
Attached patch bug1214152-valid-shell.patch (obsolete) — Splinter Review
Assignee: nobody → lhansen
Status: NEW → ASSIGNED
Attachment #8673085 - Flags: review?(terrence)
Comment on attachment 8673085 [details] [diff] [review]
bug1214152-valid-shell.patch

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

::: js/src/tests/jstests.py
@@ +159,5 @@
>      # If we do not have a shell, we must be in a special mode.
>      if options.js_shell is None and not options.make_manifests:
>          op.error('missing JS_SHELL argument')
>  
> +    if not (options.js_shell is None):

"is not" is an operator in its own right, so it would be clearer to do:
if options.js_shell is not None:

@@ +160,5 @@
>      if options.js_shell is None and not options.make_manifests:
>          op.error('missing JS_SHELL argument')
>  
> +    if not (options.js_shell is None):
> +        if not (os.path.isfile(options.js_shell) and os.access(options.js_shell, os.X_OK)):

We already have the first two parts of this test right below the parse_args() call in main(). Can you just add the os.access test there to get the same effect?
Attachment #8673085 - Flags: review?(terrence)
Attached patch bug1214152-valid-shell.patch, v2 (obsolete) — Splinter Review
Changed jstests.py as suggested
Attachment #8673085 - Attachment is obsolete: true
Attachment #8673631 - Flags: review?(terrence)
Comment on attachment 8673631 [details] [diff] [review]
bug1214152-valid-shell.patch, v2

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

Thanks!

::: js/src/tests/jstests.py
@@ +307,5 @@
>  
>  
>  def main():
>      options, prefix, requested_paths, excluded_paths = parse_args()
> +    if options.js_shell is not None and not (isfile(options.js_shell) and os.access(options.js_shell, os.X_OK)):

Please wrap this after the second and to keep things to approximately 80 chars -- people occasionally sweep the tree with a pep8 linter and complain about violations.
Attachment #8673631 - Flags: review?(terrence) → review+
Flags: needinfo?(lhansen)
This will go unfixed until I can get my Windows build environment to work, which at the current rate of progress will be never.
Assignee: lhansen → nobody
Status: ASSIGNED → NEW
The problem is that on Windows, the shell will frequently be eg dist/bin/js but the name of the file is actually dist/bin/js.exe.
Assignee: nobody → lhansen
Attachment #8673631 - Attachment is obsolete: true
https://hg.mozilla.org/mozilla-central/rev/6b34afb1a471
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla45
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: