forked from facebookresearch/CompilerGym
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgcc_search_test.py
38 lines (33 loc) · 980 Bytes
/
gcc_search_test.py
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
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import sys
import gcc_search
from absl.flags import FLAGS
from compiler_gym.service import EnvironmentNotSupported
def test_gcc_search_smoke_test(capsys):
flags = [
"argv0",
"--seed=0",
"--episode_len=2",
"--episodes=10",
"--log_interval=5",
"--benchmark=cbench-v1/crc32",
]
sys.argv = flags
FLAGS.unparse_flags()
FLAGS(flags)
try:
gcc_search.main(
[
"gcc_search",
"--gcc_benchmark=benchmark://chstone-v0/aes",
"--search=random",
"--n=3",
]
)
out, _ = capsys.readouterr()
assert "benchmark://chstone-v0/aes" in out
except EnvironmentNotSupported:
pass # GCC environment might not be supported