Skip to content

Commit

Permalink
Add check tests to meson test (#1810)
Browse files Browse the repository at this point in the history
* Add check tests to meson

* Add libusermode tests to meson

* Fix whitespace

* Stop CI testing on Ubuntu focal

* Enable deb-src on noble

* Check isn't used in container builds

* Need meson 1.1.0 for objects

* Don't install check executables

* libaio1t64 Xen deb dependency

* Xen conflicts with 17/18

* Specify ubuntu-24.04 instead of ubuntu-latest

* Use venv for python3

* Add setuptools to install.sh through pip
  • Loading branch information
tklengyel authored Sep 30, 2024
1 parent 9fe3b31 commit 5cb453d
Show file tree
Hide file tree
Showing 9 changed files with 114 additions and 23 deletions.
36 changes: 23 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ jobs:
strategy:
matrix:
os:
- 'ubuntu-20.04'
- 'ubuntu-latest'
- 'ubuntu-22.04'
- 'ubuntu-24.04'
steps:
- uses: actions/checkout@v4
- name: Install dependencies
Expand Down Expand Up @@ -101,8 +101,8 @@ jobs:
strategy:
matrix:
os:
- 'ubuntu-20.04'
- 'ubuntu-latest'
- 'ubuntu-22.04'
- 'ubuntu-24.04'
flags:
- ''
- '-Dbuildtype=debug -Db_lto=false'
Expand All @@ -117,8 +117,14 @@ jobs:
sudo apt-get update -q
sudo apt-get install -y \
clang llvm lld build-essential flex bison \
libjson-c-dev liblzo2-dev libglib2.0-dev meson ninja-build check
sudo pip3 install ctypesgen ipython
libjson-c-dev liblzo2-dev libglib2.0-dev meson ninja-build check \
python3-ipython
- name: Setup python venv for REPL
run: |
python3 -m venv venv
source venv/bin/activate
pip3 install ctypesgen
- name: Cache Xen debball
uses: actions/cache@v4
Expand All @@ -145,9 +151,14 @@ jobs:
- name: Compile ${{ matrix.flags }}
run: |
source venv/bin/activate
meson setup build --native-file llvm.ini ${{ matrix.flags }}
ninja -C build
- name: Run check ${{ matrix.flags }}
run: |
meson test -C build
tarbuild:
name: Build using autoconf tarball
runs-on: ${{ matrix.os }}
Expand All @@ -157,8 +168,8 @@ jobs:
fail-fast: false
matrix:
os:
- 'ubuntu-20.04'
- 'ubuntu-latest'
- 'ubuntu-22.04'
- 'ubuntu-24.04'

steps:
- name: Checkout repository
Expand All @@ -170,7 +181,6 @@ jobs:
sudo apt-get install -y \
clang autoconf-archive automake check \
libjson-c-dev liblzo2-dev libglib2.0-dev
sudo pip3 install ctypesgen ipython
- name: Cache Xen debball
uses: actions/cache@v4
Expand Down Expand Up @@ -225,8 +235,8 @@ jobs:
fail-fast: false
matrix:
os:
- 'ubuntu-20.04'
- 'ubuntu-latest'
- 'ubuntu-22.04'
- 'ubuntu-24.04'

steps:
- name: Checkout repository
Expand Down Expand Up @@ -291,7 +301,7 @@ jobs:
sudo apt-get update -q
sudo apt-get install -y \
clang clang-tools-15 llvm lld \
libjson-c-dev meson ninja-build check
libjson-c-dev meson ninja-build
- name: Cache Xen debball
uses: actions/cache@v4
Expand Down Expand Up @@ -337,7 +347,7 @@ jobs:
sudo apt-get update -q
sudo apt-get install -y \
clang clang-tools clang-tidy llvm lld \
libjson-c-dev meson ninja-build check
libjson-c-dev meson ninja-build
- name: Cache Xen debball
uses: actions/cache@v4
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/container-compile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ jobs:
container:
- 'debian:bullseye-slim'
- 'debian:bookworm-slim'
- 'ubuntu:focal'
- 'ubuntu:jammy'
- 'ubuntu:noble'
- 'ubuntu:rolling'

runs-on: ubuntu-latest
Expand All @@ -31,7 +31,7 @@ jobs:
apt-get install -y \
autoconf-archive flex bison libjson-c-dev build-essential \
git libtool autotools-dev libglib2.0-dev libyajl-dev liblzo2-dev \
clang llvm lld meson ninja-build check
clang llvm lld meson ninja-build
apt-get clean
- name: Configure safe dirs
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/deb.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ jobs:
container:
- "debian:bullseye"
- "debian:bookworm"
- "ubuntu:focal"
- "ubuntu:jammy"
- "ubuntu:noble"
steps:
- uses: actions/checkout@v4
with:
Expand Down Expand Up @@ -102,8 +102,8 @@ jobs:
container:
- "debian:bullseye"
- "debian:bookworm"
- "ubuntu:focal"
- "ubuntu:jammy"
- "ubuntu:noble"
container:
image: ${{ matrix.container}}
steps:
Expand Down
4 changes: 4 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ libvmi = dependency('libvmi')
jsonc = dependency('json-c')
deps = [glib, libvmi, jsonc]

# Find optional dependencies
check = dependency('check', required : false)

# Set version string
version = meson.project_version()
if not get_option('release')
version += '-' + run_command('git', 'describe', '--always', check: true).stdout().strip()
Expand Down
9 changes: 6 additions & 3 deletions package/depends.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,15 @@ DISTRIBUTION=$(lsb_release -cs)
if [ "$SYSTEM" = "Debian" ]
then
echo "deb-src http://deb.debian.org/debian ${DISTRIBUTION} main" >> /etc/apt/sources.list
apt-get update
else
sed -i 's/# deb-src/deb-src/g' /etc/apt/sources.list
apt-get update
if [ "$DISTRIBUTION" = "noble" ]; then
sed -i 's/^Types: deb$/Types: deb deb-src/' /etc/apt/sources.list.d/ubuntu.sources
else
sed -i 's/# deb-src/deb-src/g' /etc/apt/sources.list
fi
fi

apt-get update
apt-get --quiet --yes install build-essential git wget curl cmake flex bison \
libjson-c-dev autoconf-archive clang python3-dev libsystemd-dev nasm bc \
libx11-dev ninja-build python3-pip meson llvm lld zlib1g-dev
Expand Down
4 changes: 2 additions & 2 deletions package/mkdeb
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ Source: xen-hypervisor
Version: $xenversion
Architecture: $arch
Maintainer: Tamas K Lengyel <[email protected]>
Depends: libpixman-1-0, libpng16-16, libnettle6 | libnettle7 | libnettle8, libgnutls30, libfdt1, libyajl2, libaio1, libncurses6, libc6, libtinfo6, libgnutls28-dev, systemd, lvm2
Conflicts: xen-hypervisor-4.6-amd64, xen-hypervisor-4.7-amd64, xen-hypervisor-4.8-amd64, xen-hypervisor-4.9-amd64, xen-hypervisor-4.10-amd64, xen-hypervisor-4.11-amd64, xen-hypervisor-4.12-amd64, xen-hypervisor-4.13-amd64, xen-hypervisor-4.14-amd64, xen-hypervisor-4.15-amd64, xen-hypervisor-4.16-amd64
Depends: libpixman-1-0, libpng16-16, libnettle6 | libnettle7 | libnettle8, libgnutls30, libfdt1, libyajl2, libaio1 | libaio1t64, libncurses6, libc6, libtinfo6, libgnutls28-dev, systemd, lvm2
Conflicts: xen-hypervisor-4.6-amd64, xen-hypervisor-4.7-amd64, xen-hypervisor-4.8-amd64, xen-hypervisor-4.9-amd64, xen-hypervisor-4.10-amd64, xen-hypervisor-4.11-amd64, xen-hypervisor-4.12-amd64, xen-hypervisor-4.13-amd64, xen-hypervisor-4.14-amd64, xen-hypervisor-4.15-amd64, xen-hypervisor-4.16-amd64, xen-hypervisor-4.17-amd64, xen-hypervisor-4.18-amd64
Section: admin
Priority: optional
Installed-Size: $(du -ks deb | cut -f1)
Expand Down
2 changes: 1 addition & 1 deletion scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ apt-get --quiet --yes install python3-pip python3-venv

python3 -m venv /opt/volatility3
source /opt/volatility3/bin/activate
pip3 install wheel construct pefile
pip3 install wheel construct pefile setuptools
cd /opt/volatility3
python3 setup.py build
python3 -m pip install .
Expand Down
24 changes: 24 additions & 0 deletions src/libusermode/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,27 @@ libusermode = static_library('usermode',
include_directories : libusermode_h,
link_with : libdrakvuf
)

if check.found()
userhook_check = executable('userhook_check',
sources : 'check.cpp',
include_directories : libusermode_h,
dependencies : [deps, check],
link_with : [libdrakvuf, libusermode],
install : false
)
test('userhook_check', userhook_check)

if meson.version().version_compare('>=1.1.0')
utils_o = libusermode.extract_objects('printers/utils.cpp')
utils_dep = declare_dependency(objects: utils_o)
libusermode_printers_check = executable('libusermode_printers_check',
sources : 'printers/check.cpp',
include_directories : libusermode_h,
dependencies : [deps, utils_dep, check],
link_with : libdrakvuf,
install : false
)
test('libusermode_printers_check', libusermode_printers_check)
endif
endif
50 changes: 50 additions & 0 deletions src/plugins/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,17 @@ if get_option('plugin-syscalls')
plugin_sources += 'syscalls/linux.cpp'

config_h.set('ENABLE_PLUGIN_SYSCALLS', 1)

if check.found()
syscalls_check = executable('syscalls_check',
sources : 'syscalls/check.cpp',
include_directories : incdir,
dependencies : [deps, check],
link_with : libdrakvuf,
install : false
)
test('syscalls_check', syscalls_check)
endif
endif

if get_option('plugin-poolmon')
Expand Down Expand Up @@ -361,3 +372,42 @@ drakvuf_plugins = static_library('drakvuf_plugins',
link_with : [libdrakvuf, libhook, libusermode],
link_args : hardened_link_args
)

if check.found()
output_format_check = executable('output_format_check',
sources : 'output_format/check.cpp',
include_directories : incdir,
dependencies : [deps, check],
link_with : libdrakvuf,
install : false
)
test('output_format_check', output_format_check)

if meson.version().version_compare('>=1.1.0')
plugin_utils_o = drakvuf_plugins.extract_objects('plugin_utils.cpp')
plugin_utils_dep = declare_dependency(objects: plugin_utils_o)
plugin_utils_check = executable('plugin_utils_check',
sources : 'plugin_utils_check.cpp',
include_directories : incdir,
dependencies : [deps, plugin_utils_dep, check],
link_with : libdrakvuf,
install : false
)
test('plugin_utils_check', plugin_utils_check)

if get_option('plugin-procmon')
linux_utils_o = drakvuf_plugins.extract_objects('procmon/linux_utils.cpp')
winnt_o = drakvuf_plugins.extract_objects('procmon/winnt.cpp')
procmon_deps = declare_dependency(objects: [linux_utils_o, winnt_o])

procmon_check = executable('procmon_check',
sources : 'procmon/check.cpp',
include_directories : incdir,
dependencies : [deps, procmon_deps, check],
link_with : libdrakvuf,
install : false
)
test('procmon_check', procmon_check)
endif
endif
endif

0 comments on commit 5cb453d

Please sign in to comment.