[PATCH] D20161: [LNT] Adding initial support for javascript unit testing

Kristof Beyls via llvm-commits llvm-commits at lists.llvm.org
Wed May 11 06:01:22 PDT 2016


kristof.beyls created this revision.
kristof.beyls added reviewers: cmatthews, jmolloy, silvas.
kristof.beyls added a subscriber: llvm-commits.

This adds initial support for unit testing the javascript
functionality, by using the Jasmine javascript testing framework
(http://jasmine.github.io/) and the Jasmine-py
(https://github.com/jasmine/jasmine-py/) package to drive the
regression tests from python.

In this change:
* I added 2 simple javascript tests, see tests/spec/javascripts/profile_lnt_spec.js.
* Added integration for running these tests with lit, see tests/javascript_tests.py and tests/lit.cfg.
* Adapted an interface in lnt_profile.js, to make it easier to unit test (It also makes the interface cleaner, independent of unit testing needs).
* Unfortunately, there seems to be a problem with the jasmine pypi package: it installs fine with "pip install jasmine", but I get an
 error when trying to install it automatically when running "python ../lnt/setup.py develop":
 ValueError: bad marshal data (unknown type code)

The main reasons for picking Jasmine, out of quite a few different alternatives for javascript testing frameworks are:
* It seems to be one of the more popular and well-supported frameworks.
* It can easily be installed using "pip install".
* The jasmine-py package makes running the tests from python (e.g. lit) easy.

The tests are being run in a browser. When no browser is specified, a default one is used.
Probably, the most comfortable way to run these tests is to use the phantomjs head-less browser (http://phantomjs.org/).
The lit command line to run all tests (python + javascript ones) then looks like:

llvm-lit -sv -Dbrowser=phantomjs lnt/tests

As is, this isn't ready to be committed. First, the problem with installing the jasmine pypi
package as part of 'python ../lnt/setup.py develop' needs to be solved. I'm hoping to get
some review feedback on whether this looks like the right/a good direction for integrating
javascript testing into LNT's regression tests.

http://reviews.llvm.org/D20161

Files:
  lnt/server/ui/static/lnt_profile.js
  requirements.txt
  setup.py
  tests/javascript_tests.py
  tests/lit.cfg
  tests/spec/javascripts/profile_lnt_spec.js
  tests/spec/javascripts/support/jasmine.yml

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D20161.56887.patch
Type: text/x-patch
Size: 7526 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160511/b83f1048/attachment.bin>


More information about the llvm-commits mailing list