Skip to content

Commit 0ec3783

Browse files
committed
Fix the riscv test
1 parent 6e2213e commit 0ec3783

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

tests/test_riscv.py

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,38 +7,42 @@
77
sys.path.append("..")
88

99
from qiling.core import Qiling
10-
from qiling.const import QL_VERBOSE
10+
from qiling.const import QL_VERBOSE, QL_INTERCEPT
1111
from qiling.extensions.pipe import SimpleOutStream
1212

1313
class RISCVTest(unittest.TestCase):
1414
def test_riscv32_hello_linux(self):
1515
stdout = SimpleOutStream(1)
1616
ql = Qiling(['../examples/rootfs/riscv32_linux/bin/hello'], '../examples/rootfs/riscv32_linux/',
17-
verbose=QL_VERBOSE.DEBUG, stdout=stdout)
18-
19-
ql.run(end=0x66112) # avoid close 0, 1, 2
17+
verbose=QL_VERBOSE.DEFAULT, stdout=stdout)
18+
19+
def close(ql, fd):
20+
return 0
21+
ql.set_syscall("close", close, QL_INTERCEPT.CALL)
22+
ql.run()
2023
self.assertTrue(stdout.read() == b'Hello, World!\n')
2124

2225
del ql
2326

2427
def test_riscv64_hello_linux(self):
2528
stdout = SimpleOutStream(1)
2629
ql = Qiling(['../examples/rootfs/riscv64_linux/bin/hello'], '../examples/rootfs/riscv64_linux/',
27-
verbose=QL_VERBOSE.DEBUG, stdout=stdout)
28-
30+
verbose=QL_VERBOSE.DEFAULT, stdout=stdout)
2931

30-
ql.run(end=0x1249e) # avoid close 0, 1, 2
32+
def close(ql, fd):
33+
return 0
34+
ql.set_syscall("close", close, QL_INTERCEPT.CALL)
35+
ql.run()
3136
self.assertTrue(stdout.read() == b'Hello, World!\n')
3237

3338
del ql
3439

3540
def test_riscv64_hello_dyn_linux(self):
3641
stdout = SimpleOutStream(1)
3742
ql = Qiling(['../examples/rootfs/riscv64_linux/bin/hello-linux'], '../examples/rootfs/riscv64_linux/',
38-
verbose=QL_VERBOSE.DEBUG, stdout=stdout)
39-
43+
verbose=QL_VERBOSE.DEFAULT, stdout=stdout)
4044

41-
ql.run(end=0x1249e) # avoid close 0, 1, 2
45+
ql.run()
4246
self.assertTrue(stdout.read() == b'Hello, World!\n')
4347

4448
del ql

0 commit comments

Comments
 (0)