Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(platforms): add support to qemu platforms #31

Merged
merged 6 commits into from
Jun 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions framework/launch/qemu-aarch64-virt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@
#!nix-shell --pure -p unixtools.netstat -p qemu -i bash

# Check if a version argument is provided
if [ -z "$2" ]; then
echo "Usage: $0 <qemu-platform> <flash_bin_path> <bao-bin-path>"
if [ -z "$4" ]; then
echo "Usage: $0 <qemu-platform> <flash_bin_path> <bao-bin-path> <gic_version>"
exit 1
fi

qemu_platform="$1"
flash_bin_path="$2"
bao_bin_path="$3"
gic_version="$4"

if netstat -tuln | grep ":5555 " &>/dev/null; then
exit -1
Expand All @@ -18,7 +19,7 @@ fi
qemu_stderr=$(mktemp)

qemu-system-"$qemu_platform" -nographic \
-M virt,secure=on,virtualization=on,gic-version=3 \
-M virt,secure=on,virtualization=on,gic-version=$gic_version \
-cpu cortex-a53 -smp 4 -m 4G \
-bios "$flash_bin_path" \
-device loader,file="$bao_bin_path",addr=0x50000000,force-raw=on \
Expand Down
2 changes: 1 addition & 1 deletion framework/launch/qemu-riscv64-virt.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env nix-shell
#!nix-shell --pure -p qemu -i bash
#!nix-shell --pure -p unixtools.netstat -p qemu -i bash

# Check if a version argument is provided
if [ -z "$2" ]; then
Expand Down
33 changes: 30 additions & 3 deletions framework/test_framework.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
import constants as cons
import connection

script_dir = os.path.dirname(os.path.abspath(__file__))
os.chdir(script_dir)

test_config = {
'platform': '',
'nix_file': '',
Expand Down Expand Up @@ -60,6 +63,19 @@ def parse_args():
help="Used define the target platform",
default=" ")

parser.add_argument("-gicv", "--gicv",
required=False,
help="Used to define the GIC version setup for the platform",
default="")
parser.add_argument("-irqc", "--irqc",
required=False,
help="Used to define the IRQ controller setup for the platform",
default="")
parser.add_argument("-ipic", "--ipic",
required=False,
help="Used to define the IPIC setup for the platform",
default="")

input_args = parser.parse_args()
return input_args

Expand Down Expand Up @@ -116,7 +132,7 @@ def get_file_path(filename):
print(f"File '{filename}' not found in any 'result' directory.")
sys.exit(-1)

def deploy_test(platform):
def deploy_test(platform, gicv):
"""
Deploy a test on a specific platform.

Expand All @@ -127,10 +143,13 @@ def deploy_test(platform):
arch = platform.split("-")[1]
bao_bin_path = get_file_path("bao.bin")
flash_bin_path = get_file_path("flash.bin")
gic_version = gicv.split("GICV")[1]

run_cmd = "./launch/qemu-aarch64-virt.sh"
run_cmd += " " + arch
run_cmd += " " + flash_bin_path
run_cmd += " " + bao_bin_path
run_cmd += " " + str(gic_version)

elif platform in ["qemu-riscv64-virt"]:
arch = platform.split("-")[1]
Expand Down Expand Up @@ -260,7 +279,14 @@ def move_results_to_output():
BUILD_CMD += " --argstr platform " + platfrm
BUILD_CMD += " --argstr log_level " + str(args.log_level)

print(BUILD_CMD)
if args.gicv:
BUILD_CMD += " --argstr GIC_VERSION " + args.gicv
if args.irqc:
BUILD_CMD += " --argstr IRQC " + args.irqc
if args.ipic:
BUILD_CMD += " --argstr IPIC " + args.ipic

print("Building with command: " + BUILD_CMD)
res = os.system(BUILD_CMD)
if res==0:
print(cons.GREEN_TEXT +
Expand All @@ -275,5 +301,6 @@ def move_results_to_output():

move_results_to_output()

print("Interrupt Controller: " + args.gicv)
print(cons.BLUE_TEXT + "Launching QEMU..." + cons.RESET_COLOR)
deploy_test(platfrm)
deploy_test(platfrm, args.gicv)
Loading