-
Notifications
You must be signed in to change notification settings - Fork 13
/
setup.js
25 lines (21 loc) · 873 Bytes
/
setup.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
const {execSync} = require('child_process');
const path = require('path');
const { readdir } = require('fs/promises');
const ROOT_DIR = process.cwd();
const BENCHMARKS_DIR = path.join(ROOT_DIR, 'benchmarks');
const getBenchmarks = async source =>
(await readdir(source, { withFileTypes: true }))
.filter(dirent => dirent.isDirectory())
.map(dirent => dirent.name)
const main = async () => {
const benchmarks = await getBenchmarks(BENCHMARKS_DIR);
benchmarks.forEach((benchmark) => {
const BENCHMARK_DIR = path.join(BENCHMARKS_DIR, benchmark, 'tests');
Array.from(new Array(10)).forEach((_, i) => {
const REPLICA_DIR = path.join(BENCHMARK_DIR, `replica${i + 1}`);
execSync(`rm -rf ${REPLICA_DIR}`)
execSync(`cp -r ${path.join(BENCHMARK_DIR, 'original')} ${REPLICA_DIR}`)
});
});
}
main();