edits
[c11concurrency-benchmarks.git] / jsbench-2013.1 / run.py
1 #!/usr/bin/env python
2 # Copyright (C) 2011, 2012 Purdue University
3 # Written by Gregor Richards
4 # All rights reserved.
5
6 # Redistribution and use in source and binary forms, with or without
7 # modification, are permitted provided that the following conditions are met:
8
9 # 1. Redistributions of source code must retain the above copyright notice,
10 #    this list of conditions and the following disclaimer.
11 # 2. Redistributions in binary form must reproduce the above copyright notice,
12 #    this list of conditions and the following disclaimer in the documentation
13 #    and/or other materials provided with the distribution.
14
15 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16 # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
19 # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20 # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21 # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22 # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23 # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24 # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25 # POSSIBILITY OF SUCH DAMAGE.
26
27 import math
28 import os
29 import re
30 import sys
31
32 benchmarks = [
33         "amazon/chrome", "amazon/chrome-win", "amazon/firefox",
34         "amazon/firefox-win", "amazon/safari",
35         "facebook/chrome", "facebook/chrome-win", "facebook/firefox",
36         "facebook/firefox-win", "facebook/safari",
37         "google/chrome", "google/chrome-win", "google/firefox",
38         "google/firefox-win", "google/safari",
39         "twitter/chrome", "twitter/chrome-win", "twitter/firefox",
40         "twitter/firefox-win", "twitter/safari",
41         "yahoo/chrome", "yahoo/chrome-win", "yahoo/firefox",
42         "yahoo/firefox-win", "yahoo/safari",
43 ]
44
45 modes = {
46         "*": ["urem"],
47         "amazon/firefox": ["urm"],
48         "amazon/firefox-win": ["urm"],
49         "google/firefox": ["uem"],
50         "twitter/chrome-win": ["rem"]
51 };
52
53 if len(sys.argv) != 2:
54         print ("Use: python harness.py <JS executable>")
55         exit(1)
56 js = sys.argv[1]
57
58 for benchmark in benchmarks:
59         bmode = ''
60         if benchmark in modes:
61                 bmode = modes[benchmark]
62         else:
63                 bmode = modes['*']
64
65         path = benchmark + '/' + ''.join(bmode) + '.js'
66         res = os.popen(js + " " + path).read()
67
68         if res == '':
69                 res = 'error\n'
70         print(benchmark + "\t" + res, end = '')