Skip to content

Commit d0412f3

Browse files
Fixing gitignore
1 parent 9d9ef48 commit d0412f3

2 files changed

Lines changed: 42 additions & 1 deletion

File tree

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ __pycache__/
5757

5858
# Rust
5959
debug/
60-
target/
60+
/target/
6161
/build/
6262

6363
*~
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import pytest
2+
from typing import Optional, Any
3+
import logging
4+
from time import sleep
5+
from subprocess import PIPE, STDOUT
6+
from pathlib import Path
7+
8+
from itf.core.qemu.qemu import Qemu
9+
10+
logger = logging.getLogger(__name__)
11+
12+
@pytest.fixture
13+
def target(request) -> Optional[Any]:
14+
"""Returns the target instance
15+
"""
16+
17+
# if no image provided then run natively
18+
if request.config.getoption("--image-path") == "native":
19+
yield None
20+
return None
21+
22+
logger.info("Starting Target")
23+
subprocess_params = {
24+
"stdin": PIPE,
25+
"stdout": PIPE,
26+
"stderr": STDOUT,
27+
}
28+
29+
image_location = Path(request.config.getoption("--image-path"))
30+
31+
if not image_location.is_file():
32+
raise RuntimeError(f"No image found under {image_location}")
33+
34+
qemu = Qemu(str(image_location),
35+
host_first_network_device_ip_address="192.168.100.1")
36+
37+
_ = qemu.start(subprocess_params)
38+
sleep(2) # wait for system to boot
39+
yield qemu
40+
logger.info("Closing Target")
41+
qemu.stop()

0 commit comments

Comments
 (0)