-
Notifications
You must be signed in to change notification settings - Fork 0
/
run_single.js
71 lines (54 loc) · 1.5 KB
/
run_single.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
const { Builder, By, Key, until } = require('selenium-webdriver');
const { Options } = require('selenium-webdriver/chrome');
let driver;
async function test_page(url) {
await driver.get(url);
const flagElem = await driver.findElement(By.id('flag'));
await driver.wait(until.elementTextContains(flagElem, "done"), 100000);
var output = {
empty: null,
r_seq_ind: null,
r_seq_reduce: null,
r_rand_ind: null,
r_stride_k: null,
r_tile: null,
w_seq_fill: null,
w_rand_ind: null,
w_stride_k: null,
w_tile: null,
rw_seq_inc: null,
rw_gather: null,
rw_scatter: null,
rw_scatter_gather: null,
rw_tile: null,
}
for (const key of Object.keys(output)) {
const elem = await driver.findElement(By.id(key));
let content = await elem.getText();
arr = JSON.parse("[" + content + "]");
output[key] = arr;
}
return output;
}
async function main(domain, platform) {
let options;
if (platform == "android") {
options = new Options().androidChrome()
} else {
options = new Options().addArguments("--headless")
}
driver = await new Builder()
.forBrowser('chrome')
.setChromeOptions(options)
.build();
try {
const chrome_result = await test_page(`http://${domain}:8081/benchmark/web_proxy.html`);
for(const key in chrome_result) {
console.log("chrome", key, chrome_result[key])
}
} finally {
await driver.quit();
}
};
main("localhost"); // localhost on PC
// main("140.113.193.198", "android");