Closed Bug 538673 Opened 13 years ago Closed 13 years ago

jstests.py throws an exception when it can't get the directory name for "jstests.list"

Categories

(Core :: JavaScript Engine, defect)

All
Linux
defect
Not set
major

Tracking

()

RESOLVED FIXED

People

(Reporter: Waldo, Assigned: Waldo)

Details

(Whiteboard: fixed-in-tracemonkey)

Attachments

(1 file, 1 obsolete file)

Attached patch Patch (obsolete) — Splinter Review
Maybe this doesn't affect other systems, but at least on my Linux machine running 2.6.2 jstests.py throws this exception:

[jwalden@the-great-waldo-search tests]$ python ./jstests.py ../dbg/js
Traceback (most recent call last):
  File "./jstests.py", line 324, in <module>
    os.chdir(os.path.dirname(OPTIONS.manifest))
OSError: [Errno 2] No such file or directory: ''

Looking more closely, it looks like the manifest detection is finding "jstests.list" as the path to it; when we pass that to os.path.dirname, the result is "", which understandably throws off os.chdir.  It seems to me that we should just use the second item in filenames, that being the jstests.list that's a sibling to the currently-running jstests.py, which works just fine for me.
Attachment #420813 - Flags: review?(dmandelin)
Attached patch Patch 2Splinter Review
That patch busts on my Mac because it tries to change dirs to '' before running the tests. Can you try this one?
Attachment #420813 - Attachment is obsolete: true
Attachment #420823 - Flags: review?(jwalden+bmo)
Attachment #420813 - Flags: review?(dmandelin)
Comment on attachment 420823 [details] [diff] [review]
Patch 2

Works for me, but...weird.  So effectively this is being run:

  file = os.path.join(os.path.dirname(__file__), 'jstests.list')
  dir = os.path.dirname(file)
  os.chdir(dir)

What's os.path.dirname(__file__) on your system?  And what's the join returning?  I'm trying to understand how your system returns something that would have the empty string as a dirname; it just doesn't make sense by normal Unix path conventions to me.
Attachment #420823 - Flags: review?(jwalden+bmo) → review+
(In reply to comment #2)
> (From update of attachment 420823 [details] [diff] [review])
> Works for me, but...weird.  So effectively this is being run:
> 
>   file = os.path.join(os.path.dirname(__file__), 'jstests.list')
>   dir = os.path.dirname(file)
>   os.chdir(dir)
> 
> What's os.path.dirname(__file__) on your system?

It's ''. I think the os.path functions mostly do string manipulation without trying to canonicalize things (unless you ask for that), so a relative path like 'foo.py' has dirname ''.
http://hg.mozilla.org/mozilla-central/rev/ee08be15b932
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.