Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spidermonkey tests #156

Closed
wants to merge 5 commits into from

Conversation

iankronquist
Copy link

I don't expect this to get merged in the first go, but it's a first stab.
To fix #75.

I copied /js/src/tests to into /source/spidermonkey-tests
I removed /js/src/tests/Intl because it depends on the Intl object which
is baked into the js engine.
The version I copied was changeset 215929:2a3399e38768 from the Mozilla inbound
repository.
According to my understanding, this code is available under the Mozilla
Public License, which allows including the code as part of a "Larger
Work", such as Higgs. I copied /toolkit/content/license.html to
/source/spidermonkey-tests/license.html.
@maximecb
Copy link
Contributor

Jesus, over 7000 files. The GitHub web interface took several seconds to load, woah.

Thank you for doing this work. Can you explain what you did, what kind of results you got so far, what you learned about the way their tests work?

There are way more tests than I realized. I'm expecting that lots of these tests will not pass. I was hoping that we could add the SpiderMonkey tests under tests/spidermonkey, and have the existing test runner run them, if possible. I'm thinking we can use your alternate test runner to identify the tests that work and those that don't. We can then open a bunch of issues for bugs found.

My goal would be to begin slowly migrating/porting the working tests to the "normal" test-runner, so that they are always run when people do make test. The point of tests is not just to discover bugs but also to make sure that things do not get broken in the future.

Nitpicks: it seems you use tabs in your source. We prefer spaces only, with tabs being 4 spaces wide. Some of the files included seem not relevant (Makefile.in, README.txt)

@iankronquist
Copy link
Author

I copied /js/src/tests to into /source/spidermonkey-tests
I removed /js/src/tests/Intl because it depends on the Intl object which
is baked into the js engine.
The version I copied was changeset 215929:2a3399e38768 from the Mozilla inbound
repository. Inbound is used to build Firefox Nightly, but all the tests pass under the Mozilla
js shell.
According to my understanding, this code is available under the Mozilla
Public License, which allows including the code as part of a "Larger
Work", such as Higgs. I copied /toolkit/content/license.html to
/source/spidermonkey-tests/license.html.

Rewriting the test runner was interesting. I had to go spelunking through the very thorough and professional python build system and try and isolate what was relevant and what was not. The test runner I wrote is ugly and can be improved. I noticed that some of the tests require objects from other js files in parent directories (typically browser.js shell.js or jsref.js) which seem to mock out parts of the browser. Loading these files for the appropriate tests required splitting up the runTests function into three (poorly-named) functions which cherry-pick the right files and directories to test or include. If you get an error about a global variable which hasn't been seen before it's probably because one of these has not been properly loaded.
Sorry about the tabs, I'll go fix my .vimrc. I kind of think the README.txt belongs in the repo to explain a little more about the tests, but I removed the Makefile and a couple other things. I suspect there is more cruft to remove, but this is a start.
As for results. I'm sorry to say that Higgs segfaults when running the first test. I haven't investigated why,
but here are the results of the run:

Ian:(source)(spidermonkey-tests) → ./higgs spidermonkey-test-runner.js 
Starting spidermonkey-test-runner.js...
 --- 
Running: ./spidermonkey-tests/ecma/Array/15.4-1.js and including:   [ './spidermonkey-tests/ecma/browser.js', './spidermonkey-tests/ecma/jsref.js', './spidermonkey-tests/ecma/shell.js', './spidermonkey-tests/ecma/template.js', './spidermonkey-tests/ecma/Array/browser.js',... ]

Caught segmentation fault
IP=null
vm.curInstr: Assertion failed (stats.d@166)


It's possible that the spidermonkey test runner is incomplete, but it seems to be working. Maybe I should write tests for it.

@maximecb
Copy link
Contributor

Does it segfault on all the tests? Does anything pass?

@iankronquist
Copy link
Author

I tried a couple different files, they all seem to segfault at line 166 of stats.d, which is an assertion about the timer. I'm not sure why this is happening, I'm trying to figure out how to get gdb/lldb to show a backtrace so I can tell what's going on.

@maximecb
Copy link
Contributor

Must be some bug in the JIT that gets triggered. Either by your test runner, or by some JS code that's getting loaded for all the tests. You can try commenting out or not loading specific bits of code to try and narrow down what's failing.

I added a few bits of info about debugging on this wiki page: https://github.com/maximecb/Higgs/wiki/Debugging-Higgs

@maximecb maximecb closed this Dec 31, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Port Mozilla tests to Higgs
2 participants