Introduce `xfstests` and integrate it into CI workflows
This commit is contained in:
parent
b0407dd517
commit
92223f2e0e
|
|
@ -6,7 +6,7 @@ branding:
|
||||||
inputs:
|
inputs:
|
||||||
# Test Configuration
|
# Test Configuration
|
||||||
auto_test:
|
auto_test:
|
||||||
description: 'Test type (general, osdk, boot, syscall, test)'
|
description: 'Test type (general, osdk, boot, syscall, test, xfstests)'
|
||||||
required: true
|
required: true
|
||||||
release:
|
release:
|
||||||
description: 'Whether to run in release mode'
|
description: 'Whether to run in release mode'
|
||||||
|
|
@ -45,6 +45,9 @@ inputs:
|
||||||
boot_protocol:
|
boot_protocol:
|
||||||
description: 'Boot protocol (linux-efi-handover64/multiboot/multiboot2/linux-legacy32)'
|
description: 'Boot protocol (linux-efi-handover64/multiboot/multiboot2/linux-legacy32)'
|
||||||
required: false
|
required: false
|
||||||
|
mem:
|
||||||
|
description: 'Guest memory size'
|
||||||
|
required: false
|
||||||
|
|
||||||
runs:
|
runs:
|
||||||
using: 'composite'
|
using: 'composite'
|
||||||
|
|
@ -91,6 +94,7 @@ runs:
|
||||||
[[ -n "${{ inputs.syscall_test_suite }}" ]] && CMD+=" SYSCALL_TEST_SUITE=${{ inputs.syscall_test_suite }}"
|
[[ -n "${{ inputs.syscall_test_suite }}" ]] && CMD+=" SYSCALL_TEST_SUITE=${{ inputs.syscall_test_suite }}"
|
||||||
[[ -n "${{ inputs.syscall_test_workdir }}" ]] && CMD+=" SYSCALL_TEST_WORKDIR=${{ inputs.syscall_test_workdir }}"
|
[[ -n "${{ inputs.syscall_test_workdir }}" ]] && CMD+=" SYSCALL_TEST_WORKDIR=${{ inputs.syscall_test_workdir }}"
|
||||||
[[ -n "${{ inputs.boot_protocol }}" ]] && CMD+=" BOOT_PROTOCOL=${{ inputs.boot_protocol }}"
|
[[ -n "${{ inputs.boot_protocol }}" ]] && CMD+=" BOOT_PROTOCOL=${{ inputs.boot_protocol }}"
|
||||||
|
[[ -n "${{ inputs.mem }}" ]] && CMD+=" MEM=${{ inputs.mem }}"
|
||||||
|
|
||||||
echo "Executing: $CMD"
|
echo "Executing: $CMD"
|
||||||
eval $CMD
|
eval $CMD
|
||||||
|
|
|
||||||
|
|
@ -109,6 +109,7 @@ jobs:
|
||||||
smp: ${{ matrix.smp }}
|
smp: ${{ matrix.smp }}
|
||||||
netdev: ${{ matrix.netdev || 'tap' }}
|
netdev: ${{ matrix.netdev || 'tap' }}
|
||||||
scheme: ${{ matrix.scheme }}
|
scheme: ${{ matrix.scheme }}
|
||||||
|
mem: ${{ matrix.mem }}
|
||||||
extra_blocklists: ${{ matrix.extra_blocklists }}
|
extra_blocklists: ${{ matrix.extra_blocklists }}
|
||||||
syscall_test_suite: 'ltp'
|
syscall_test_suite: 'ltp'
|
||||||
syscall_test_workdir: ${{ matrix.syscall_test_workdir }}
|
syscall_test_workdir: ${{ matrix.syscall_test_workdir }}
|
||||||
|
|
@ -124,11 +125,27 @@ jobs:
|
||||||
smp: ${{ matrix.smp }}
|
smp: ${{ matrix.smp }}
|
||||||
netdev: ${{ matrix.netdev || 'tap' }}
|
netdev: ${{ matrix.netdev || 'tap' }}
|
||||||
scheme: ${{ matrix.scheme }}
|
scheme: ${{ matrix.scheme }}
|
||||||
|
mem: ${{ matrix.mem }}
|
||||||
extra_blocklists: ${{ matrix.extra_blocklists }}
|
extra_blocklists: ${{ matrix.extra_blocklists }}
|
||||||
syscall_test_suite: 'gvisor'
|
syscall_test_suite: 'gvisor'
|
||||||
syscall_test_workdir: ${{ matrix.syscall_test_workdir }}
|
syscall_test_workdir: ${{ matrix.syscall_test_workdir }}
|
||||||
boot_protocol: ${{ matrix.boot_protocol || 'linux-efi-handover64' }}
|
boot_protocol: ${{ matrix.boot_protocol || 'linux-efi-handover64' }}
|
||||||
|
|
||||||
|
xfstests:
|
||||||
|
runs-on: ubuntu-4-cores-150GB-ssd
|
||||||
|
container:
|
||||||
|
image: asterinas/asterinas:0.17.0-20260114
|
||||||
|
options: --device=/dev/kvm --privileged
|
||||||
|
timeout-minutes: 30
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- name: Run xfstests
|
||||||
|
uses: ./.github/actions/test
|
||||||
|
with:
|
||||||
|
auto_test: 'xfstests'
|
||||||
|
release: true
|
||||||
|
mem: '12G'
|
||||||
|
|
||||||
osdk-test:
|
osdk-test:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
strategy:
|
||||||
|
|
|
||||||
8
Makefile
8
Makefile
|
|
@ -23,6 +23,8 @@ NO_DEFAULT_FEATURES ?= 0
|
||||||
COVERAGE ?= 0
|
COVERAGE ?= 0
|
||||||
# Specify whether to build regression tests under `test/initramfs/src/apps`.
|
# Specify whether to build regression tests under `test/initramfs/src/apps`.
|
||||||
ENABLE_BASIC_TEST ?= false
|
ENABLE_BASIC_TEST ?= false
|
||||||
|
# Specify whether to build xfstests.
|
||||||
|
ENABLE_XFSTESTS ?= false
|
||||||
# Specify the primary system console (supported: tty0, ttyS0, hvc0).
|
# Specify the primary system console (supported: tty0, ttyS0, hvc0).
|
||||||
# - tty0: The active virtual terminal (VT).
|
# - tty0: The active virtual terminal (VT).
|
||||||
# - ttyS0: The serial (UART) terminal.
|
# - ttyS0: The serial (UART) terminal.
|
||||||
|
|
@ -104,6 +106,9 @@ ENABLE_BASIC_TEST := true
|
||||||
endif
|
endif
|
||||||
CARGO_OSDK_BUILD_ARGS += --kcmd-args="INTEL_TDX=$(INTEL_TDX)"
|
CARGO_OSDK_BUILD_ARGS += --kcmd-args="INTEL_TDX=$(INTEL_TDX)"
|
||||||
CARGO_OSDK_BUILD_ARGS += --init-args="/test/run_general_test.sh"
|
CARGO_OSDK_BUILD_ARGS += --init-args="/test/run_general_test.sh"
|
||||||
|
else ifeq ($(AUTO_TEST), xfstests)
|
||||||
|
ENABLE_XFSTESTS := true
|
||||||
|
CARGO_OSDK_BUILD_ARGS += --init-args="/xfstests/run_xfstests.sh -R /xfstests/run.list"
|
||||||
else ifeq ($(AUTO_TEST), boot)
|
else ifeq ($(AUTO_TEST), boot)
|
||||||
ENABLE_BASIC_TEST := true
|
ENABLE_BASIC_TEST := true
|
||||||
CARGO_OSDK_BUILD_ARGS += --init-args="/test/boot_hello.sh"
|
CARGO_OSDK_BUILD_ARGS += --init-args="/test/boot_hello.sh"
|
||||||
|
|
@ -315,6 +320,9 @@ ifeq ($(AUTO_TEST), syscall)
|
||||||
else ifeq ($(AUTO_TEST), test)
|
else ifeq ($(AUTO_TEST), test)
|
||||||
@tail --lines 100 qemu.log | grep -q "^All general tests passed." \
|
@tail --lines 100 qemu.log | grep -q "^All general tests passed." \
|
||||||
|| (echo "General test failed" && exit 1)
|
|| (echo "General test failed" && exit 1)
|
||||||
|
else ifeq ($(AUTO_TEST), xfstests)
|
||||||
|
@tail --lines 100 qemu.log | grep -q "^All xfstests passed." \
|
||||||
|
|| (echo "Xfstests failed" && exit 1)
|
||||||
else ifeq ($(AUTO_TEST), boot)
|
else ifeq ($(AUTO_TEST), boot)
|
||||||
@tail --lines 100 qemu.log | grep -q "^Successfully booted." \
|
@tail --lines 100 qemu.log | grep -q "^Successfully booted." \
|
||||||
|| (echo "Boot test failed" && exit 1)
|
|| (echo "Boot test failed" && exit 1)
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ ENABLE_BASIC_TEST ?= false
|
||||||
# - asterinas: Define both `__asterinas__` and `__linux__`. Tests may fail in Linux.
|
# - asterinas: Define both `__asterinas__` and `__linux__`. Tests may fail in Linux.
|
||||||
# - linux: Define only `__linux__`. Tests may fail in Asterinas.
|
# - linux: Define only `__linux__`. Tests may fail in Asterinas.
|
||||||
BASIC_TEST_PLATFORM ?= asterinas
|
BASIC_TEST_PLATFORM ?= asterinas
|
||||||
|
ENABLE_XFSTESTS ?= false
|
||||||
DNS_SERVER ?= none
|
DNS_SERVER ?= none
|
||||||
# Set Nix's cached tarballs to be live for a longer period of time (30 days) to avoid network traffics.
|
# Set Nix's cached tarballs to be live for a longer period of time (30 days) to avoid network traffics.
|
||||||
# Nix's default value is rather small (1 hour or 3600 seconds).
|
# Nix's default value is rather small (1 hour or 3600 seconds).
|
||||||
|
|
@ -28,6 +29,8 @@ INITRAMFS_COMPRESSED := true
|
||||||
endif
|
endif
|
||||||
EXT2_IMAGE := $(BUILD_DIR)/ext2.img
|
EXT2_IMAGE := $(BUILD_DIR)/ext2.img
|
||||||
EXFAT_IMAGE := $(BUILD_DIR)/exfat.img
|
EXFAT_IMAGE := $(BUILD_DIR)/exfat.img
|
||||||
|
XFSTESTS_TEST_IMAGE := $(BUILD_DIR)/xfstests_test.img
|
||||||
|
XFSTESTS_SCRATCH_IMAGE := $(BUILD_DIR)/xfstests_scratch.img
|
||||||
|
|
||||||
# Include benchmark, if BENCHMARK is set.
|
# Include benchmark, if BENCHMARK is set.
|
||||||
ifeq ($(BENCHMARK), none)
|
ifeq ($(BENCHMARK), none)
|
||||||
|
|
@ -56,6 +59,8 @@ ifeq ($(OSDK_TARGET_ARCH), loongarch64)
|
||||||
build: $(EXT2_IMAGE) $(EXFAT_IMAGE)
|
build: $(EXT2_IMAGE) $(EXFAT_IMAGE)
|
||||||
@echo "For loongarch, we generate a fake initramfs to successfully test or build."
|
@echo "For loongarch, we generate a fake initramfs to successfully test or build."
|
||||||
@touch $(INITRAMFS_IMAGE)
|
@touch $(INITRAMFS_IMAGE)
|
||||||
|
else ifeq ($(ENABLE_XFSTESTS), true)
|
||||||
|
build: $(INITRAMFS_IMAGE) $(EXT2_IMAGE) $(EXFAT_IMAGE) $(XFSTESTS_TEST_IMAGE) $(XFSTESTS_SCRATCH_IMAGE)
|
||||||
else
|
else
|
||||||
build: $(INITRAMFS_IMAGE) $(EXT2_IMAGE) $(EXFAT_IMAGE)
|
build: $(INITRAMFS_IMAGE) $(EXT2_IMAGE) $(EXFAT_IMAGE)
|
||||||
endif
|
endif
|
||||||
|
|
@ -69,6 +74,7 @@ $(INITRAMFS_IMAGE): $(INITRAMFS)
|
||||||
--argstr basicTestPlatform $(BASIC_TEST_PLATFORM) \
|
--argstr basicTestPlatform $(BASIC_TEST_PLATFORM) \
|
||||||
--arg enableBenchmark $(ENABLE_BENCHMARK) \
|
--arg enableBenchmark $(ENABLE_BENCHMARK) \
|
||||||
--arg enableSyscallTest $(ENABLE_SYSCALL_TEST) \
|
--arg enableSyscallTest $(ENABLE_SYSCALL_TEST) \
|
||||||
|
--arg enableXfstests $(ENABLE_XFSTESTS) \
|
||||||
--argstr syscallTestSuite $(SYSCALL_TEST_SUITE) \
|
--argstr syscallTestSuite $(SYSCALL_TEST_SUITE) \
|
||||||
--argstr syscallTestWorkDir $(SYSCALL_TEST_WORKDIR) \
|
--argstr syscallTestWorkDir $(SYSCALL_TEST_WORKDIR) \
|
||||||
--argstr dnsServer ${DNS_SERVER} \
|
--argstr dnsServer ${DNS_SERVER} \
|
||||||
|
|
@ -86,6 +92,7 @@ $(INITRAMFS):
|
||||||
--argstr basicTestPlatform $(BASIC_TEST_PLATFORM) \
|
--argstr basicTestPlatform $(BASIC_TEST_PLATFORM) \
|
||||||
--arg enableBenchmark $(ENABLE_BENCHMARK) \
|
--arg enableBenchmark $(ENABLE_BENCHMARK) \
|
||||||
--arg enableSyscallTest $(ENABLE_SYSCALL_TEST) \
|
--arg enableSyscallTest $(ENABLE_SYSCALL_TEST) \
|
||||||
|
--arg enableXfstests $(ENABLE_XFSTESTS) \
|
||||||
--argstr syscallTestSuite $(SYSCALL_TEST_SUITE) \
|
--argstr syscallTestSuite $(SYSCALL_TEST_SUITE) \
|
||||||
--argstr syscallTestWorkDir $(SYSCALL_TEST_WORKDIR) \
|
--argstr syscallTestWorkDir $(SYSCALL_TEST_WORKDIR) \
|
||||||
--argstr dnsServer ${DNS_SERVER} \
|
--argstr dnsServer ${DNS_SERVER} \
|
||||||
|
|
@ -176,6 +183,16 @@ $(EXFAT_IMAGE):
|
||||||
@fallocate -l 64M $(EXFAT_IMAGE)
|
@fallocate -l 64M $(EXFAT_IMAGE)
|
||||||
@mkfs.exfat $(EXFAT_IMAGE)
|
@mkfs.exfat $(EXFAT_IMAGE)
|
||||||
|
|
||||||
|
$(XFSTESTS_TEST_IMAGE):
|
||||||
|
@mkdir -p $(BUILD_DIR)
|
||||||
|
@fallocate -l 12G $(XFSTESTS_TEST_IMAGE)
|
||||||
|
@mkfs.ext2 $(XFSTESTS_TEST_IMAGE)
|
||||||
|
|
||||||
|
$(XFSTESTS_SCRATCH_IMAGE):
|
||||||
|
@mkdir -p $(BUILD_DIR)
|
||||||
|
@fallocate -l 12G $(XFSTESTS_SCRATCH_IMAGE)
|
||||||
|
@mkfs.ext2 $(XFSTESTS_SCRATCH_IMAGE)
|
||||||
|
|
||||||
.PHONY: format
|
.PHONY: format
|
||||||
format:
|
format:
|
||||||
@$(MAKE) --no-print-directory -C src/apps format
|
@$(MAKE) --no-print-directory -C src/apps format
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
{ target ? "x86_64", enableBasicTest ? false, basicTestPlatform ? "asterinas"
|
{ target ? "x86_64", enableBasicTest ? false, basicTestPlatform ? "asterinas"
|
||||||
, enableBenchmark ? false, enableSyscallTest ? false, syscallTestSuite ? "ltp"
|
, enableBenchmark ? false, enableSyscallTest ? false, syscallTestSuite ? "ltp"
|
||||||
, syscallTestWorkDir ? "/tmp", dnsServer ? "none", smp ? 1
|
, syscallTestWorkDir ? "/tmp", dnsServer ? "none", smp ? 1
|
||||||
, initramfsCompressed ? true, }:
|
, initramfsCompressed ? true, enableXfstests ? false, }:
|
||||||
let
|
let
|
||||||
crossSystem.config = if target == "x86_64" then
|
crossSystem.config = if target == "x86_64" then
|
||||||
"x86_64-unknown-linux-gnu"
|
"x86_64-unknown-linux-gnu"
|
||||||
|
|
@ -26,13 +26,16 @@ in rec {
|
||||||
apps = pkgs.callPackage ./apps.nix { testPlatform = basicTestPlatform; };
|
apps = pkgs.callPackage ./apps.nix { testPlatform = basicTestPlatform; };
|
||||||
busybox = pkgs.busybox;
|
busybox = pkgs.busybox;
|
||||||
benchmark = pkgs.callPackage ./benchmark { };
|
benchmark = pkgs.callPackage ./benchmark { };
|
||||||
|
xfstests = pkgs.callPackage ./fs/xfstests.nix { };
|
||||||
syscall = pkgs.callPackage ./syscall {
|
syscall = pkgs.callPackage ./syscall {
|
||||||
inherit smp;
|
inherit smp;
|
||||||
testSuite = syscallTestSuite;
|
testSuite = syscallTestSuite;
|
||||||
workDir = syscallTestWorkDir;
|
workDir = syscallTestWorkDir;
|
||||||
};
|
};
|
||||||
|
|
||||||
initramfs = pkgs.callPackage ./initramfs.nix {
|
initramfs = pkgs.callPackage ./initramfs.nix {
|
||||||
inherit busybox;
|
inherit busybox;
|
||||||
|
xfstests = if enableXfstests then xfstests else null;
|
||||||
apps = if enableBasicTest then apps else null;
|
apps = if enableBasicTest then apps else null;
|
||||||
benchmark = if enableBenchmark then benchmark else null;
|
benchmark = if enableBenchmark then benchmark else null;
|
||||||
syscall = if enableSyscallTest then syscall else null;
|
syscall = if enableSyscallTest then syscall else null;
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,87 @@
|
||||||
|
{ lib, stdenvNoCC, pkgs }:
|
||||||
|
|
||||||
|
stdenvNoCC.mkDerivation {
|
||||||
|
name = "xfstests-package";
|
||||||
|
|
||||||
|
buildCommand = ''
|
||||||
|
# Create output directory structure
|
||||||
|
mkdir -p $out/xfstests
|
||||||
|
|
||||||
|
# Copy xfstests test suite from Nix package
|
||||||
|
cp -r ${pkgs.xfstests}/lib/xfstests/* $out/xfstests/
|
||||||
|
|
||||||
|
# Create wrapper script for running xfstests
|
||||||
|
cat > $out/xfstests/run_xfstests.sh << 'EOF'
|
||||||
|
#!/bin/sh
|
||||||
|
set -e
|
||||||
|
export PATH=\
|
||||||
|
${pkgs.perl}/bin:\
|
||||||
|
${pkgs.bash}/bin:\
|
||||||
|
${pkgs.gnugrep}/bin:\
|
||||||
|
${pkgs.gnused}/bin:\
|
||||||
|
${pkgs.gawk}/bin:\
|
||||||
|
${pkgs.coreutils}/bin:\
|
||||||
|
${pkgs.findutils}/bin:\
|
||||||
|
${pkgs.util-linux}/bin:\
|
||||||
|
${pkgs.util-linux}/sbin:\
|
||||||
|
${pkgs.bc}/bin:\
|
||||||
|
${pkgs.kmod}/bin:\
|
||||||
|
${pkgs.kmod}/sbin:\
|
||||||
|
${pkgs.xfsprogs}/bin:\
|
||||||
|
${pkgs.xfsprogs}/sbin:\
|
||||||
|
${pkgs.e2fsprogs}/bin:\
|
||||||
|
${pkgs.e2fsprogs}/sbin:\
|
||||||
|
/bin:\
|
||||||
|
/usr/bin:\
|
||||||
|
/sbin:\
|
||||||
|
/usr/sbin
|
||||||
|
cd /xfstests
|
||||||
|
RUNLIST_FILE=""
|
||||||
|
ARGS=""
|
||||||
|
while [ $# -gt 0 ]; do
|
||||||
|
case "$1" in
|
||||||
|
-R|--runlist)
|
||||||
|
RUNLIST_FILE="$2"
|
||||||
|
shift 2
|
||||||
|
;;
|
||||||
|
--)
|
||||||
|
shift
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
ARGS="$ARGS \"$1\""
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
for arg in "$@"; do
|
||||||
|
ARGS="$ARGS \"$arg\""
|
||||||
|
done
|
||||||
|
if [ -n "$RUNLIST_FILE" ]; then
|
||||||
|
if [ ! -f "$RUNLIST_FILE" ]; then
|
||||||
|
echo "Run list file not found: $RUNLIST_FILE" >&2
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
while IFS= read -r test; do
|
||||||
|
case "$test" in
|
||||||
|
""|\#*) continue ;;
|
||||||
|
esac
|
||||||
|
ARGS="$ARGS \"$test\""
|
||||||
|
done < "$RUNLIST_FILE"
|
||||||
|
fi
|
||||||
|
# shellcheck disable=SC2086
|
||||||
|
eval ./check $ARGS
|
||||||
|
echo "All xfstests passed."
|
||||||
|
EOF
|
||||||
|
chmod +x $out/xfstests/run_xfstests.sh
|
||||||
|
|
||||||
|
# Copy local.config from source directory
|
||||||
|
cp ${./../../src/fs/xfstests/local.config} $out/xfstests/local.config
|
||||||
|
|
||||||
|
# Copy block.list into xfstests directory
|
||||||
|
cp ${./../../src/fs/xfstests/block.list} $out/xfstests/block.list
|
||||||
|
|
||||||
|
# Copy run.list into xfstests directory
|
||||||
|
cp ${./../../src/fs/xfstests/run.list} $out/xfstests/run.list
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
{ lib, stdenvNoCC, fetchFromGitHub, hostPlatform, writeClosure, busybox, apps
|
{ lib, stdenvNoCC, fetchFromGitHub, hostPlatform, writeClosure, busybox
|
||||||
, benchmark, syscall, dnsServer, pkgs }:
|
, xfstests, apps, benchmark, syscall, dnsServer, pkgs }:
|
||||||
let
|
let
|
||||||
etc = lib.fileset.toSource {
|
etc = lib.fileset.toSource {
|
||||||
root = ./../src/etc;
|
root = ./../src/etc;
|
||||||
|
|
@ -15,7 +15,9 @@ let
|
||||||
resolv_conf = pkgs.callPackage ./resolv_conf.nix { dnsServer = dnsServer; };
|
resolv_conf = pkgs.callPackage ./resolv_conf.nix { dnsServer = dnsServer; };
|
||||||
# Whether the initramfs should include evtest, a common tool to debug input devices (`/dev/input/eventX`)
|
# Whether the initramfs should include evtest, a common tool to debug input devices (`/dev/input/eventX`)
|
||||||
is_evtest_included = false;
|
is_evtest_included = false;
|
||||||
|
|
||||||
all_pkgs = [ busybox etc resolv_conf ]
|
all_pkgs = [ busybox etc resolv_conf ]
|
||||||
|
++ lib.optionals (xfstests != null) [ xfstests ]
|
||||||
++ lib.optionals (apps != null) [ apps.package ]
|
++ lib.optionals (apps != null) [ apps.package ]
|
||||||
++ lib.optionals (benchmark != null) [ benchmark.package ]
|
++ lib.optionals (benchmark != null) [ benchmark.package ]
|
||||||
++ lib.optionals (syscall != null) [ syscall.package ]
|
++ lib.optionals (syscall != null) [ syscall.package ]
|
||||||
|
|
@ -24,7 +26,8 @@ in stdenvNoCC.mkDerivation {
|
||||||
name = "initramfs";
|
name = "initramfs";
|
||||||
buildCommand = ''
|
buildCommand = ''
|
||||||
mkdir -p $out/{dev,etc,root,usr,opt,tmp,var,proc,sys}
|
mkdir -p $out/{dev,etc,root,usr,opt,tmp,var,proc,sys}
|
||||||
mkdir -p $out/{benchmark,test,ext2,exfat}
|
mkdir -p $out/{benchmark,test,xfstests,ext2,exfat}
|
||||||
|
mkdir -p $out/xfstests/{test,scratch}
|
||||||
mkdir -p $out/usr/{bin,sbin,lib,lib64,local}
|
mkdir -p $out/usr/{bin,sbin,lib,lib64,local}
|
||||||
ln -sfn usr/bin $out/bin
|
ln -sfn usr/bin $out/bin
|
||||||
ln -sfn usr/sbin $out/sbin
|
ln -sfn usr/sbin $out/sbin
|
||||||
|
|
@ -61,6 +64,11 @@ in stdenvNoCC.mkDerivation {
|
||||||
cp -L ${gvisor_libs}/libm.so.6 $out/lib/x86_64-linux-gnu/libm.so.6
|
cp -L ${gvisor_libs}/libm.so.6 $out/lib/x86_64-linux-gnu/libm.so.6
|
||||||
''}
|
''}
|
||||||
|
|
||||||
|
${lib.optionalString (xfstests != null) ''
|
||||||
|
# Copy xfstests package content
|
||||||
|
cp -r ${xfstests}/xfstests/* $out/xfstests/
|
||||||
|
''}
|
||||||
|
|
||||||
# Use `writeClosure` to retrieve all dependencies of the specified packages.
|
# Use `writeClosure` to retrieve all dependencies of the specified packages.
|
||||||
# This will generate a text file containing the complete closure of the packages,
|
# This will generate a text file containing the complete closure of the packages,
|
||||||
# including the packages themselves.
|
# including the packages themselves.
|
||||||
|
|
|
||||||
|
|
@ -10,3 +10,11 @@ mount -t cgroup2 none /sys/fs/cgroup
|
||||||
mount -t configfs none /sys/kernel/config
|
mount -t configfs none /sys/kernel/config
|
||||||
mount -t ext2 /dev/vda /ext2
|
mount -t ext2 /dev/vda /ext2
|
||||||
mount -t exfat /dev/vdb /exfat
|
mount -t exfat /dev/vdb /exfat
|
||||||
|
|
||||||
|
# Mount xfstests images if they exist
|
||||||
|
if [ -b /dev/vdc ]; then
|
||||||
|
mount -t ext2 /dev/vdc /xfstests/test
|
||||||
|
fi
|
||||||
|
if [ -b /dev/vdd ]; then
|
||||||
|
mount -t ext2 /dev/vdd /xfstests/scratch
|
||||||
|
fi
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,23 @@
|
||||||
|
generic/015
|
||||||
|
generic/027
|
||||||
|
generic/084
|
||||||
|
generic/204
|
||||||
|
generic/226
|
||||||
|
generic/247
|
||||||
|
generic/251
|
||||||
|
generic/274
|
||||||
|
generic/275
|
||||||
|
generic/315
|
||||||
|
generic/344
|
||||||
|
generic/391
|
||||||
|
generic/426
|
||||||
|
generic/446
|
||||||
|
generic/464
|
||||||
|
generic/466
|
||||||
|
generic/467
|
||||||
|
generic/477
|
||||||
|
generic/524
|
||||||
|
generic/558
|
||||||
|
generic/590
|
||||||
|
generic/591
|
||||||
|
generic/604
|
||||||
|
|
@ -0,0 +1,15 @@
|
||||||
|
export FSTYP=ext2
|
||||||
|
|
||||||
|
export TEST_DEV=/dev/vdc
|
||||||
|
export TEST_DIR=/xfstests/test
|
||||||
|
|
||||||
|
export SCRATCH_DEV=/dev/vdd
|
||||||
|
export SCRATCH_MNT=/xfstests/scratch
|
||||||
|
|
||||||
|
export MOUNT_OPTIONS="-o noload,noacl"
|
||||||
|
export EXT_MOUNT_OPTIONS="-o noload,noacl"
|
||||||
|
|
||||||
|
export FSTYP_HAS_NON_DEFAULT_OPTS=0
|
||||||
|
export SELINUX_MOUNT_OPTIONS=" "
|
||||||
|
|
||||||
|
export MKFS_OPTIONS="-F"
|
||||||
|
|
@ -0,0 +1,54 @@
|
||||||
|
generic/001
|
||||||
|
generic/002
|
||||||
|
generic/005
|
||||||
|
generic/006
|
||||||
|
generic/007
|
||||||
|
generic/013
|
||||||
|
generic/014
|
||||||
|
generic/023
|
||||||
|
generic/028
|
||||||
|
generic/035
|
||||||
|
generic/069
|
||||||
|
generic/074
|
||||||
|
generic/089
|
||||||
|
generic/109
|
||||||
|
generic/124
|
||||||
|
generic/126
|
||||||
|
generic/129
|
||||||
|
generic/132
|
||||||
|
generic/141
|
||||||
|
generic/184
|
||||||
|
generic/213
|
||||||
|
generic/221
|
||||||
|
generic/224
|
||||||
|
generic/236
|
||||||
|
generic/246
|
||||||
|
generic/248
|
||||||
|
generic/249
|
||||||
|
generic/269
|
||||||
|
generic/273
|
||||||
|
generic/308
|
||||||
|
generic/309
|
||||||
|
generic/312
|
||||||
|
generic/313
|
||||||
|
generic/320
|
||||||
|
generic/339
|
||||||
|
generic/340
|
||||||
|
generic/346
|
||||||
|
generic/360
|
||||||
|
generic/401
|
||||||
|
generic/406
|
||||||
|
generic/428
|
||||||
|
generic/437
|
||||||
|
generic/438
|
||||||
|
generic/443
|
||||||
|
generic/453
|
||||||
|
generic/488
|
||||||
|
generic/532
|
||||||
|
generic/568
|
||||||
|
generic/609
|
||||||
|
generic/615
|
||||||
|
generic/619
|
||||||
|
generic/696
|
||||||
|
generic/701
|
||||||
|
generic/707
|
||||||
|
|
@ -14,12 +14,14 @@
|
||||||
# - CONSOLE: "hvc0" to enable virtio console;
|
# - CONSOLE: "hvc0" to enable virtio console;
|
||||||
# - SMP: number of CPUs;
|
# - SMP: number of CPUs;
|
||||||
# - MEM: amount of memory, e.g. "8G";
|
# - MEM: amount of memory, e.g. "8G";
|
||||||
# - VNC_PORT: VNC port, default is "42".
|
# - VNC_PORT: VNC port, default is "42";
|
||||||
|
# - ENABLE_XFSTESTS: "true" or "false", whether to attach xfstests images.
|
||||||
|
|
||||||
OVMF=${OVMF:-"on"}
|
OVMF=${OVMF:-"on"}
|
||||||
VHOST=${VHOST:-"off"}
|
VHOST=${VHOST:-"off"}
|
||||||
VSOCK=${VSOCK:-"off"}
|
VSOCK=${VSOCK:-"off"}
|
||||||
NETDEV=${NETDEV:-"user"}
|
NETDEV=${NETDEV:-"user"}
|
||||||
|
ENABLE_XFSTESTS=${ENABLE_XFSTESTS:-"false"}
|
||||||
CONSOLE=${CONSOLE:-"hvc0"}
|
CONSOLE=${CONSOLE:-"hvc0"}
|
||||||
|
|
||||||
SSH_RAND_PORT=${SSH_PORT:-$(shuf -i 1024-65535 -n 1)}
|
SSH_RAND_PORT=${SSH_PORT:-$(shuf -i 1024-65535 -n 1)}
|
||||||
|
|
@ -100,6 +102,14 @@ COMMON_QEMU_ARGS="\
|
||||||
-drive if=none,format=raw,id=x1,file=./test/initramfs/build/exfat.img \
|
-drive if=none,format=raw,id=x1,file=./test/initramfs/build/exfat.img \
|
||||||
"
|
"
|
||||||
|
|
||||||
|
# Add xfstests drives if enabled
|
||||||
|
if [ "$ENABLE_XFSTESTS" = "true" ]; then
|
||||||
|
COMMON_QEMU_ARGS="$COMMON_QEMU_ARGS \
|
||||||
|
-drive if=none,format=raw,id=x2,file=./test/initramfs/build/xfstests_test.img \
|
||||||
|
-drive if=none,format=raw,id=x3,file=./test/initramfs/build/xfstests_scratch.img \
|
||||||
|
"
|
||||||
|
fi
|
||||||
|
|
||||||
if [ "$1" = "iommu" ]; then
|
if [ "$1" = "iommu" ]; then
|
||||||
if [ "$OVMF" = "off" ]; then
|
if [ "$OVMF" = "off" ]; then
|
||||||
echo "Warning: OVMF is off, enabling it for IOMMU support." 1>&2
|
echo "Warning: OVMF is off, enabling it for IOMMU support." 1>&2
|
||||||
|
|
@ -118,6 +128,17 @@ QEMU_ARGS="\
|
||||||
-machine q35,kernel-irqchip=split \
|
-machine q35,kernel-irqchip=split \
|
||||||
-device virtio-blk-pci,bus=pcie.0,addr=0x6,drive=x0,serial=vext2,disable-legacy=on,disable-modern=off,queue-size=64,num-queues=1,request-merging=off,backend_defaults=off,discard=off,write-zeroes=off,event_idx=off,indirect_desc=off,queue_reset=off$IOMMU_DEV_EXTRA \
|
-device virtio-blk-pci,bus=pcie.0,addr=0x6,drive=x0,serial=vext2,disable-legacy=on,disable-modern=off,queue-size=64,num-queues=1,request-merging=off,backend_defaults=off,discard=off,write-zeroes=off,event_idx=off,indirect_desc=off,queue_reset=off$IOMMU_DEV_EXTRA \
|
||||||
-device virtio-blk-pci,bus=pcie.0,addr=0x7,drive=x1,serial=vexfat,disable-legacy=on,disable-modern=off,queue-size=64,num-queues=1,request-merging=off,backend_defaults=off,discard=off,write-zeroes=off,event_idx=off,indirect_desc=off,queue_reset=off$IOMMU_DEV_EXTRA \
|
-device virtio-blk-pci,bus=pcie.0,addr=0x7,drive=x1,serial=vexfat,disable-legacy=on,disable-modern=off,queue-size=64,num-queues=1,request-merging=off,backend_defaults=off,discard=off,write-zeroes=off,event_idx=off,indirect_desc=off,queue_reset=off$IOMMU_DEV_EXTRA \
|
||||||
|
"
|
||||||
|
|
||||||
|
# Add xfstests devices if enabled
|
||||||
|
if [ "$ENABLE_XFSTESTS" = "true" ]; then
|
||||||
|
QEMU_ARGS="$QEMU_ARGS \
|
||||||
|
-device virtio-blk-pci,bus=pcie.0,addr=0x8,drive=x2,serial=vxfstest,disable-legacy=on,disable-modern=off,queue-size=64,num-queues=1,request-merging=off,backend_defaults=off,discard=off,write-zeroes=off,event_idx=off,indirect_desc=off,queue_reset=off$IOMMU_DEV_EXTRA \
|
||||||
|
-device virtio-blk-pci,bus=pcie.0,addr=0x9,drive=x3,serial=vxfsscratch,disable-legacy=on,disable-modern=off,queue-size=64,num-queues=1,request-merging=off,backend_defaults=off,discard=off,write-zeroes=off,event_idx=off,indirect_desc=off,queue_reset=off$IOMMU_DEV_EXTRA \
|
||||||
|
"
|
||||||
|
fi
|
||||||
|
|
||||||
|
QEMU_ARGS="$QEMU_ARGS \
|
||||||
-device virtio-net-pci,netdev=net01,disable-legacy=on,disable-modern=off$VIRTIO_NET_FEATURES$IOMMU_DEV_EXTRA \
|
-device virtio-net-pci,netdev=net01,disable-legacy=on,disable-modern=off$VIRTIO_NET_FEATURES$IOMMU_DEV_EXTRA \
|
||||||
-device virtio-serial-pci,disable-legacy=on,disable-modern=off$IOMMU_DEV_EXTRA \
|
-device virtio-serial-pci,disable-legacy=on,disable-modern=off$IOMMU_DEV_EXTRA \
|
||||||
$CONSOLE_ARGS \
|
$CONSOLE_ARGS \
|
||||||
|
|
@ -131,6 +152,17 @@ MICROVM_QEMU_ARGS="\
|
||||||
-no-user-config \
|
-no-user-config \
|
||||||
-device virtio-blk-device,drive=x0,serial=vext2 \
|
-device virtio-blk-device,drive=x0,serial=vext2 \
|
||||||
-device virtio-blk-device,drive=x1,serial=vexfat \
|
-device virtio-blk-device,drive=x1,serial=vexfat \
|
||||||
|
"
|
||||||
|
|
||||||
|
# Add xfstests devices for microvm if enabled
|
||||||
|
if [ "$ENABLE_XFSTESTS" = "true" ]; then
|
||||||
|
MICROVM_QEMU_ARGS="$MICROVM_QEMU_ARGS \
|
||||||
|
-device virtio-blk-device,drive=x2,serial=vxfstest \
|
||||||
|
-device virtio-blk-device,drive=x3,serial=vxfsscratch \
|
||||||
|
"
|
||||||
|
fi
|
||||||
|
|
||||||
|
MICROVM_QEMU_ARGS="$MICROVM_QEMU_ARGS \
|
||||||
-device virtio-keyboard-device \
|
-device virtio-keyboard-device \
|
||||||
-device virtio-net-device,netdev=net01 \
|
-device virtio-net-device,netdev=net01 \
|
||||||
-device virtio-serial-device \
|
-device virtio-serial-device \
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue