Replace script runner to use mocha.js tests
[WebKit.git] / Websites / perf.webkit.org / tools / run-tests.py
1 #!/usr/bin/python
2
3 import os
4 import subprocess
5
6
7 def main():
8     tools_dir = os.path.dirname(__file__)
9     root_dir = os.path.abspath(os.path.join(tools_dir, '..'))
10     node_modules_dir = os.path.join(root_dir, 'node_modules')
11
12     os.chdir(root_dir)
13     packages = ['mocha', 'pg']
14     for package_name in packages:
15         target_dir = os.path.join(node_modules_dir, package_name)
16         if not os.path.isdir(target_dir):
17             subprocess.call(['npm', 'install', package_name])
18
19     mocha_path = os.path.join(node_modules_dir, 'mocha/bin/mocha')
20     return subprocess.call([mocha_path, 'unit-tests', 'server-tests'])
21
22 if __name__ == "__main__":
23     main()