Skip to content

Commit f750750

Browse files
committed
add test for opal timer
Signed-off-by: heyujiao99 <[email protected]>
1 parent 2b94d08 commit f750750

File tree

2 files changed

+19
-7
lines changed

2 files changed

+19
-7
lines changed

.github/workflows/riscv64-qemu-test.yaml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
- name: Install depencencies
1313
run: |
1414
sudo apt update
15-
sudo apt install -y --no-install-recommends qemu-user wget
15+
sudo apt install -y --no-install-recommends qemu-user qemu-user-static binfmt-support wget
1616
wget ${riscv_gnu_toolchain_download_path}
1717
tar -xvf riscv64-glibc-ubuntu-24.04-gcc-nightly-2025.07.03-nightly.tar.xz -C /opt
1818
sed -i "s|libdir='/mnt/riscv/riscv64-unknown-linux-gnu/lib'|libdir='/opt/riscv/riscv64-unknown-linux-gnu/lib'|g" /opt/riscv/riscv64-unknown-linux-gnu/lib/libatomic.la
@@ -46,3 +46,14 @@ jobs:
4646
export PATH="/opt/riscv/bin:$PATH"
4747
export LD_LIBRARY_PATH="/opt/riscv/lib:$LD_LIBRARY_PATH"
4848
make check
49+
50+
- name: Run Opal Timer
51+
run: |
52+
export QEMU_LD_PREFIX=/opt/riscv/sysroot
53+
export PATH="/opt/riscv/bin:$PATH"
54+
export LD_LIBRARY_PATH="/opt/riscv/lib:$LD_LIBRARY_PATH"
55+
mkdir -p /opt/riscv/sysroot/proc/device-tree/cpus/
56+
touch /opt/riscv/sysroot/proc/device-tree/cpus/timebase-frequency
57+
grep "bogomips" /proc/cpuinfo | head -n 1 | awk '{printf("%d", $3*500000)}' | perl -e 'print pack("N", <STDIN>)' > /opt/riscv/sysroot/proc/device-tree/cpus/timebase-frequency
58+
cd test/util
59+
qemu-riscv64 -cpu rv64,v=true,vext_spec=v1.0,vlen=128 /opt/riscv/bin/mpirun -n 1 ./opal_timer

test/util/Makefile.am

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ check_PROGRAMS = \
4343
opal_bit_ops \
4444
opal_path_nfs \
4545
opal_json \
46-
opal_sha256
46+
opal_sha256 \
47+
opal_timer
4748

4849
TESTS = \
4950
$(check_PROGRAMS)
@@ -95,11 +96,11 @@ opal_path_nfs_DEPENDENCIES = $(opal_path_nfs_LDADD)
9596
# $(top_builddir)/test/support/libsupport.a
9697
#opal_os_path_DEPENDENCIES = $(opal_os_path_LDADD)
9798

98-
#opal_timer_SOURCES = opal_timer.c
99-
#opal_timer_LDADD = \
100-
# $(top_builddir)/opal/lib@[email protected] \
101-
# $(top_builddir)/test/support/libsupport.a
102-
#opal_timer_DEPENDENCIES = $(opal_timer_LDADD)
99+
opal_timer_SOURCES = opal_timer.c
100+
opal_timer_LDADD = \
101+
$(top_builddir)/opal/lib@[email protected] \
102+
$(top_builddir)/test/support/libsupport.a
103+
opal_timer_DEPENDENCIES = $(opal_timer_LDADD)
103104

104105

105106
#orte_sys_info_SOURCES = orte_sys_info.c

0 commit comments

Comments
 (0)