Refactor regression test to support fine-grained build
This commit is contained in:
parent
6e79dc14d2
commit
f6f896ef64
4
Makefile
4
Makefile
|
|
@ -99,13 +99,9 @@ CARGO_OSDK_BUILD_ARGS += --kcmd-args="EXTRA_BLOCKLISTS_DIRS=$(EXTRA_BLOCKLISTS_D
|
|||
CARGO_OSDK_BUILD_ARGS += --init-args="/opt/syscall_test/run_syscall_test.sh"
|
||||
else ifeq ($(AUTO_TEST), regression)
|
||||
ENABLE_REGRESSION_TEST := true
|
||||
ifneq ($(SMP), 1)
|
||||
CARGO_OSDK_BUILD_ARGS += --kcmd-args="BLOCK_UNSUPPORTED_SMP_TESTS=1"
|
||||
endif
|
||||
CARGO_OSDK_BUILD_ARGS += --kcmd-args="INTEL_TDX=$(INTEL_TDX)"
|
||||
CARGO_OSDK_BUILD_ARGS += --init-args="/test/run_regression_test.sh"
|
||||
else ifeq ($(AUTO_TEST), boot)
|
||||
ENABLE_REGRESSION_TEST := true
|
||||
CARGO_OSDK_BUILD_ARGS += --init-args="/test/boot_hello.sh"
|
||||
else ifeq ($(AUTO_TEST), vsock)
|
||||
ENABLE_REGRESSION_TEST := true
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ ENABLE_REGRESSION_TEST ?= false
|
|||
# Specify platform macros when building regression tests (supported: asterinas, linux).
|
||||
# - asterinas: Define both `__asterinas__` and `__linux__`. Tests may fail in Linux.
|
||||
# - linux: Define only `__linux__`. Tests may fail in Asterinas.
|
||||
BASIC_TEST_PLATFORM ?= asterinas
|
||||
TEST_PLATFORM ?= asterinas
|
||||
DNS_SERVER ?= none
|
||||
# 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).
|
||||
|
|
@ -65,9 +65,9 @@ $(INITRAMFS_IMAGE): $(INITRAMFS)
|
|||
@nix-build \
|
||||
--tarball-ttl $(NIXPKGS_CACHE_TTL) \
|
||||
--argstr target $(OSDK_TARGET_ARCH) \
|
||||
--arg enableRegressionTest $(ENABLE_REGRESSION_TEST) \
|
||||
--argstr basicTestPlatform $(BASIC_TEST_PLATFORM) \
|
||||
--argstr testPlatform $(TEST_PLATFORM) \
|
||||
--arg enableBenchmark $(ENABLE_BENCHMARK) \
|
||||
--arg enableRegressionTest $(ENABLE_REGRESSION_TEST) \
|
||||
--arg enableSyscallTest $(ENABLE_SYSCALL_TEST) \
|
||||
--argstr syscallTestSuite $(SYSCALL_TEST_SUITE) \
|
||||
--argstr syscallTestWorkDir $(SYSCALL_TEST_WORKDIR) \
|
||||
|
|
@ -82,9 +82,9 @@ $(INITRAMFS):
|
|||
@nix-build \
|
||||
--tarball-ttl $(NIXPKGS_CACHE_TTL) \
|
||||
--argstr target $(OSDK_TARGET_ARCH) \
|
||||
--arg enableRegressionTest $(ENABLE_REGRESSION_TEST) \
|
||||
--argstr basicTestPlatform $(BASIC_TEST_PLATFORM) \
|
||||
--argstr testPlatform $(TEST_PLATFORM) \
|
||||
--arg enableBenchmark $(ENABLE_BENCHMARK) \
|
||||
--arg enableRegressionTest $(ENABLE_REGRESSION_TEST) \
|
||||
--arg enableSyscallTest $(ENABLE_SYSCALL_TEST) \
|
||||
--argstr syscallTestSuite $(SYSCALL_TEST_SUITE) \
|
||||
--argstr syscallTestWorkDir $(SYSCALL_TEST_WORKDIR) \
|
||||
|
|
@ -133,14 +133,6 @@ riscv64_pkgs:
|
|||
-A regression.package \
|
||||
-A syscall.ltp
|
||||
|
||||
general_pkgs:
|
||||
@nix-build \
|
||||
nix/default.nix \
|
||||
--tarball-ttl $(NIXPKGS_CACHE_TTL) \
|
||||
$(NIX_QUIET) \
|
||||
--out-link /nix/var/nix/gcroots/auto/general \
|
||||
-A regression.mongoose_src
|
||||
|
||||
install_host_pkgs:
|
||||
@nix-env \
|
||||
--file nix/default.nix \
|
||||
|
|
|
|||
|
|
@ -5,18 +5,18 @@ This directory contains the test suites of Asterinas running in initramfs, inclu
|
|||
## Directory Structure
|
||||
|
||||
```
|
||||
test/
|
||||
initramfs/
|
||||
├── src/
|
||||
│ ├── regression/ # Regression tests
|
||||
│ ├── benchmark/ # Supported benchmark test suites
|
||||
│ ├── regression/ # Regression tests
|
||||
│ ├── etc/ # Configuration files
|
||||
│ └── syscall/ # Syscall test suites
|
||||
│ ├── ltp/ # LTP syscall test suite
|
||||
│ └── gvisor/ # Gvisor syscall test suite
|
||||
├── nix/
|
||||
│ ├── benchmark/ # Nix expressions for `benchmark`
|
||||
│ ├── regression/ # Nix expressions for `regression`
|
||||
│ ├── syscall/ # Nix expressions for `syscall`
|
||||
│ ├── regression.nix # Nix expression for `regression`
|
||||
│ └── initramfs.nix # Nix expression for packaging initramfs
|
||||
├── Makefile
|
||||
└── README.md
|
||||
|
|
|
|||
|
|
@ -1,8 +1,7 @@
|
|||
{ target ? "x86_64", enableRegressionTest ? false
|
||||
, basicTestPlatform ? "asterinas", enableBenchmark ? false
|
||||
, enableSyscallTest ? false, syscallTestSuite ? "ltp"
|
||||
, syscallTestWorkDir ? "/tmp", dnsServer ? "none", smp ? 1
|
||||
, initramfsCompressed ? true, }:
|
||||
{ target ? "x86_64", testPlatform ? "asterinas", enableBenchmark ? false
|
||||
, enableRegressionTest ? false, enableSyscallTest ? false
|
||||
, syscallTestSuite ? "ltp", syscallTestWorkDir ? "/tmp", dnsServer ? "none"
|
||||
, smp ? 1, initramfsCompressed ? true, }:
|
||||
let
|
||||
crossSystem.config = if target == "x86_64" then
|
||||
"x86_64-unknown-linux-gnu"
|
||||
|
|
@ -24,10 +23,9 @@ let
|
|||
};
|
||||
in rec {
|
||||
# Packages needed by initramfs
|
||||
regression =
|
||||
pkgs.callPackage ./regression.nix { testPlatform = basicTestPlatform; };
|
||||
busybox = pkgs.busybox;
|
||||
benchmark = pkgs.callPackage ./benchmark { };
|
||||
regression = pkgs.callPackage ./regression { inherit testPlatform; };
|
||||
syscall = pkgs.callPackage ./syscall {
|
||||
inherit smp;
|
||||
testSuite = syscallTestSuite;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
{ lib, stdenvNoCC, fetchFromGitHub, hostPlatform, writeClosure, busybox
|
||||
, regression, benchmark, syscall, dnsServer, pkgs }:
|
||||
let
|
||||
boot_hello = builtins.path { path = ./../src/boot_hello.sh; };
|
||||
etc = lib.fileset.toSource {
|
||||
root = ./../src/etc;
|
||||
fileset = ./../src/etc;
|
||||
|
|
@ -37,6 +38,8 @@ in stdenvNoCC.mkDerivation {
|
|||
|
||||
cp -r ${etc}/* $out/etc/
|
||||
|
||||
cp ${boot_hello} $out/test/boot_hello.sh
|
||||
|
||||
cp ${resolv_conf}/resolv.conf $out/etc/
|
||||
|
||||
${lib.optionalString (regression != null) ''
|
||||
|
|
|
|||
|
|
@ -1,47 +0,0 @@
|
|||
{ lib, stdenv, fetchFromGitHub, hostPlatform, glibc, libnl, callPackage
|
||||
, testPlatform, }: rec {
|
||||
|
||||
tdxAttest = lib.optionalAttrs (builtins.getEnv "INTEL_TDX" == "1")
|
||||
(callPackage ./tdx-attest.nix { });
|
||||
|
||||
mongoose_src = fetchFromGitHub {
|
||||
owner = "cesanta";
|
||||
repo = "mongoose";
|
||||
rev = "7.13";
|
||||
sha256 = "sha256-9XHUE8SVOG/X7SIB52C8EImPx4XZ7B/5Ojwmb0PkiuI";
|
||||
};
|
||||
|
||||
package = stdenv.mkDerivation {
|
||||
pname = "regression";
|
||||
version = "0.1.0";
|
||||
src = lib.fileset.toSource {
|
||||
root = ./../src;
|
||||
fileset = ./../src/regression;
|
||||
};
|
||||
|
||||
MONGOOSE_DIR = "${mongoose_src}";
|
||||
|
||||
INTEL_TDX = builtins.getEnv "INTEL_TDX";
|
||||
TDX_ATTEST_DIR = lib.optionalString (builtins.getEnv "INTEL_TDX" == "1")
|
||||
"${tdxAttest}/QuoteGeneration";
|
||||
|
||||
HOST_PLATFORM = "${hostPlatform.system}";
|
||||
CC = "${stdenv.cc.targetPrefix}cc";
|
||||
C_FLAGS = "-I${libnl.dev}/include/libnl3"
|
||||
+ (if testPlatform == "asterinas" then " -D__asterinas__" else "");
|
||||
# FIXME: Excluding `glibc` allows the build to succeed, but causes some tests to fail.
|
||||
buildInputs = [ glibc glibc.static libnl ];
|
||||
buildCommand = ''
|
||||
BUILD_DIR=$(mktemp -d)
|
||||
mkdir -p $BUILD_DIR
|
||||
cp -r $src/regression $BUILD_DIR/
|
||||
|
||||
pushd $BUILD_DIR
|
||||
make --no-print-directory -C regression
|
||||
popd
|
||||
|
||||
mkdir -p $out
|
||||
mv build/initramfs/test/* $out/
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
{ lib, stdenv, glibc, hostPlatform, dir, testPlatform ? "asterinas"
|
||||
, extraEnv ? { }, extraBuildInputs ? [ ] }:
|
||||
stdenv.mkDerivation ({
|
||||
pname = "${dir}-test";
|
||||
version = "0.1.0";
|
||||
src = lib.fileset.toSource {
|
||||
root = ./../../src/regression;
|
||||
fileset = lib.fileset.unions [
|
||||
./../../src/regression/common
|
||||
./../../src/regression/${dir}
|
||||
];
|
||||
};
|
||||
|
||||
HOST_PLATFORM = "${hostPlatform.system}";
|
||||
TEST_PLATFORM = "${testPlatform}";
|
||||
|
||||
CC = "${stdenv.cc.targetPrefix}cc";
|
||||
|
||||
buildInputs = [ glibc glibc.static ] ++ extraBuildInputs;
|
||||
buildCommand = ''
|
||||
mkdir -p $out
|
||||
make --no-print-directory BUILD_DIR=$(mktemp -d) OUTPUT_DIR=$out -C "$src/${dir}"
|
||||
'';
|
||||
} // extraEnv)
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
{ lib, pkgs, stdenv, callPackage, testPlatform ? "asterinas", }: rec {
|
||||
scripts = lib.fileset.toSource {
|
||||
root = ./../../src/regression/scripts;
|
||||
fileset = lib.fileset.fileFilter (file: file.hasExt "sh")
|
||||
./../../src/regression/scripts;
|
||||
};
|
||||
|
||||
allPkgs = lib.listToAttrs (map (dir: {
|
||||
name = dir;
|
||||
value = callPackage ./common.nix { inherit dir testPlatform; };
|
||||
}) [ "device" "fs" "hello_world" "io" "ipc" "memory" "process" "security" ])
|
||||
// {
|
||||
network = callPackage ./common.nix {
|
||||
dir = "network";
|
||||
inherit testPlatform;
|
||||
extraEnv = { C_FLAGS = " -I${pkgs.libnl.dev}/include/libnl3"; };
|
||||
extraBuildInputs = [ pkgs.libnl ];
|
||||
};
|
||||
} // lib.optionalAttrs (pkgs.hostPlatform.system == "x86_64-linux") {
|
||||
intel_tdx = callPackage ./common.nix {
|
||||
dir = "intel_tdx";
|
||||
inherit testPlatform;
|
||||
extraEnv = {
|
||||
TDX_ATTEST_DIR =
|
||||
"${callPackage ./tdx-attest.nix { }}/QuoteGeneration";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
package = stdenv.mkDerivation {
|
||||
pname = "regression";
|
||||
version = "0.1.0";
|
||||
buildCommand = ''
|
||||
mkdir -p $out
|
||||
cp ${scripts}/* $out
|
||||
|
||||
${lib.concatMapStringsSep "\n"
|
||||
(name: "ln -s ${toString allPkgs.${name}}/${name} $out/${name}")
|
||||
(lib.attrNames allPkgs)}
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
@ -7,70 +7,37 @@ MAKEFLAGS += --no-builtin-rules
|
|||
|
||||
MKFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST)))
|
||||
CUR_DIR := $(patsubst %/,%,$(dir $(MKFILE_PATH)))
|
||||
BUILD_DIR ?= $(CUR_DIR)/../../build
|
||||
OUTPUT_DIR ?= $(BUILD_DIR)/initramfs/test
|
||||
|
||||
INITRAMFS ?= $(CUR_DIR)/../../build/initramfs
|
||||
TEST_BUILD_DIR ?= $(INITRAMFS)/test
|
||||
|
||||
# These test apps are sorted by name
|
||||
TEST_APPS := \
|
||||
alarm \
|
||||
capability \
|
||||
chroot \
|
||||
clone3 \
|
||||
cpu_affinity \
|
||||
devfs \
|
||||
epoll \
|
||||
eventfd2 \
|
||||
execve \
|
||||
exit \
|
||||
ext2 \
|
||||
fdatasync \
|
||||
file_io \
|
||||
fork_c \
|
||||
getcpu \
|
||||
getpid \
|
||||
hello_pie \
|
||||
inotify \
|
||||
itimer \
|
||||
mmap \
|
||||
mongoose \
|
||||
namespace \
|
||||
network \
|
||||
pipe \
|
||||
prctl \
|
||||
process \
|
||||
procfs \
|
||||
pseudofs \
|
||||
pthread \
|
||||
pty \
|
||||
sched \
|
||||
shm \
|
||||
vsock \
|
||||
|
||||
# TODO: Refactor those tests for target CPU arch using C macro-based conditional compilation.
|
||||
ifeq ($(HOST_PLATFORM), x86_64-linux)
|
||||
TEST_APPS += \
|
||||
fork \
|
||||
hello_c \
|
||||
SUBDIRS := \
|
||||
device \
|
||||
fs \
|
||||
hello_world \
|
||||
signal_c
|
||||
io \
|
||||
ipc \
|
||||
memory \
|
||||
network \
|
||||
process \
|
||||
scripts \
|
||||
security \
|
||||
|
||||
ifeq ($(HOST_PLATFORM), x86_64-linux)
|
||||
SUBDIRS += intel_tdx
|
||||
endif
|
||||
|
||||
ifeq ($(INTEL_TDX), 1)
|
||||
TEST_APPS += generate_tdx_quote
|
||||
endif
|
||||
|
||||
# The C head and source files of all the apps, excluding the downloaded mongoose files
|
||||
C_SOURCES := \
|
||||
$(shell find . -type f \( -name "*.c" -or -name "*.h" \) \
|
||||
! -name "mongoose.c" ! -name "mongoose.h")
|
||||
# The C head and source files of all testcases.
|
||||
C_SOURCES := $(shell find . -type f \( -name "*.c" -or -name "*.h" \))
|
||||
|
||||
.PHONY: all
|
||||
all: $(TEST_APPS) scripts
|
||||
all: $(SUBDIRS)
|
||||
|
||||
.PHONY: $(TEST_APPS)
|
||||
$(TEST_APPS):
|
||||
@make --no-print-directory -C $@
|
||||
$(OUTPUT_DIR):
|
||||
@mkdir -p $@
|
||||
|
||||
.PHONY: $(SUBDIRS)
|
||||
$(SUBDIRS): $(OUTPUT_DIR)
|
||||
@make --no-print-directory BUILD_DIR=$(BUILD_DIR) OUTPUT_DIR=$(OUTPUT_DIR) -C $@
|
||||
|
||||
.PHONY: format
|
||||
format:
|
||||
|
|
@ -81,10 +48,3 @@ format:
|
|||
check:
|
||||
@echo "Checking code format for regression tests..."
|
||||
@clang-format --dry-run --Werror $(C_SOURCES)
|
||||
|
||||
$(TEST_BUILD_DIR):
|
||||
@mkdir -p $@
|
||||
|
||||
.PHONY: scripts
|
||||
scripts: | $(TEST_BUILD_DIR)
|
||||
@make --no-print-directory BUILD_DIR=$(TEST_BUILD_DIR) -C scripts
|
||||
|
|
|
|||
|
|
@ -1,5 +0,0 @@
|
|||
# SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
include ../test_common.mk
|
||||
|
||||
EXTRA_C_FLAGS :=
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
# SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
include ../test_common.mk
|
||||
|
||||
EXTRA_C_FLAGS :=
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
# SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
include ../test_common.mk
|
||||
|
||||
EXTRA_C_FLAGS :=
|
||||
|
|
@ -0,0 +1,72 @@
|
|||
# SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
MAIN_MAKEFILE := $(firstword $(MAKEFILE_LIST))
|
||||
INCLUDE_MAKEFILE := $(lastword $(MAKEFILE_LIST))
|
||||
CUR_DIR := $(shell dirname $(realpath $(MAIN_MAKEFILE)))
|
||||
INCLUDE_MAKEFILE_DIR := $(shell dirname $(realpath $(INCLUDE_MAKEFILE)))
|
||||
COMMON_PREFIX := $(shell dirname $(INCLUDE_MAKEFILE_DIR))
|
||||
CUR_DIR_NAME := $(subst $(COMMON_PREFIX)/,,$(CUR_DIR))
|
||||
|
||||
BUILD_DIR ?= $(INCLUDE_MAKEFILE_DIR)/../../../build
|
||||
OUTPUT_DIR ?= $(BUILD_DIR)/initramfs/test
|
||||
OBJ_OUTPUT_DIR := $(OUTPUT_DIR)/$(CUR_DIR_NAME)
|
||||
DEP_OUTPUT_DIR := $(BUILD_DIR)/dep/$(CUR_DIR_NAME)
|
||||
C_SRCS := $(wildcard *.c)
|
||||
C_OBJS := $(addprefix $(OBJ_OUTPUT_DIR)/,$(C_SRCS:%.c=%))
|
||||
C_DEPS := $(addprefix $(DEP_OUTPUT_DIR)/,$(C_SRCS:%.c=%.d))
|
||||
ASM_SRCS := $(wildcard *.S)
|
||||
ASM_OBJS := $(addprefix $(OBJ_OUTPUT_DIR)/,$(ASM_SRCS:%.S=%))
|
||||
SCRIPTS := $(addprefix $(OBJ_OUTPUT_DIR)/, $(wildcard *.sh))
|
||||
|
||||
CC ?= gcc
|
||||
C_FLAGS += -Wall -Werror
|
||||
|
||||
HOST_PLATFORM ?= x86_64-linux
|
||||
TEST_PLATFORM ?= asterinas
|
||||
|
||||
ifeq ($(TEST_PLATFORM),asterinas)
|
||||
C_FLAGS += -D__asterinas__
|
||||
endif
|
||||
|
||||
ifneq ($(C_OBJS_FILTER),)
|
||||
FILTERED_C_OBJS := $(addprefix $(OBJ_OUTPUT_DIR)/,$(C_OBJS_FILTER))
|
||||
C_OBJS := $(filter-out $(FILTERED_C_OBJS),$(C_OBJS))
|
||||
endif
|
||||
|
||||
ifneq ($(ASM_OBJS_FILTER),)
|
||||
FILTERED_ASM_OBJS := $(addprefix $(OBJ_OUTPUT_DIR)/,$(ASM_OBJS_FILTER))
|
||||
ASM_OBJS := $(filter-out $(FILTERED_ASM_OBJS),$(ASM_OBJS))
|
||||
endif
|
||||
|
||||
ifneq ($(SCRIPTS_FILTER),)
|
||||
FILTERED_SCRIPTS := $(addprefix $(OBJ_OUTPUT_DIR)/,$(SCRIPTS_FILTER))
|
||||
SCRIPTS := $(filter-out $(FILTERED_SCRIPTS),$(SCRIPTS))
|
||||
endif
|
||||
|
||||
ifneq ($(SUBDIRS_FILTER),)
|
||||
SUBDIRS := $(filter-out $(SUBDIRS_FILTER),$(SUBDIRS))
|
||||
endif
|
||||
|
||||
.PHONY: all
|
||||
all: $(C_OBJS) $(ASM_OBJS) $(SUBDIRS) $(SCRIPTS)
|
||||
|
||||
$(OBJ_OUTPUT_DIR) $(DEP_OUTPUT_DIR):
|
||||
@mkdir -p $@
|
||||
|
||||
$(OBJ_OUTPUT_DIR)/%: %.c | $(OBJ_OUTPUT_DIR) $(DEP_OUTPUT_DIR)
|
||||
@$(CC) $(C_FLAGS) $< -o $@ $(EXTRA_C_FLAGS) \
|
||||
-MMD -MF $(DEP_OUTPUT_DIR)/$*.d
|
||||
@echo "CC <= $@"
|
||||
|
||||
-include $(C_DEPS)
|
||||
|
||||
$(OBJ_OUTPUT_DIR)/%: %.S | $(OBJ_OUTPUT_DIR)
|
||||
@$(CC) $(C_FLAGS) $(EXTRA_C_FLAGS) $< -o $@
|
||||
@echo "CC <= $@"
|
||||
|
||||
$(OBJ_OUTPUT_DIR)/%.sh: %.sh | $(OBJ_OUTPUT_DIR)
|
||||
@cp $< $@
|
||||
|
||||
.PHONY: $(SUBDIRS)
|
||||
$(SUBDIRS):
|
||||
@make --no-print-directory -C $@
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
# SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
include ../test_common.mk
|
||||
|
||||
EXTRA_C_FLAGS :=
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
# SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
include ../test_common.mk
|
||||
|
||||
EXTRA_C_FLAGS :=
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
# SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
SUBDIRS := pty
|
||||
|
||||
include ../common/Makefile
|
||||
|
|
@ -9,7 +9,7 @@
|
|||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "../test.h"
|
||||
#include "../common/test.h"
|
||||
|
||||
#define INPUT_DIR "/dev/input"
|
||||
#define MAX_EVDEV_DEVICES 16
|
||||
|
|
@ -15,7 +15,7 @@
|
|||
#include <sys/wait.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "../test.h"
|
||||
#include "../common/test.h"
|
||||
|
||||
#define FB_DEVICE "/dev/fb0"
|
||||
#define PAGE_SIZE 4096
|
||||
|
|
@ -6,7 +6,7 @@
|
|||
#include <sys/stat.h>
|
||||
#include <sys/sysmacros.h>
|
||||
#include <sys/poll.h>
|
||||
#include "../test.h"
|
||||
#include "../common/test.h"
|
||||
|
||||
#define DEVICE_PATH "/dev/full"
|
||||
#define READ_SIZE 100
|
||||
|
|
@ -1,3 +1,3 @@
|
|||
# SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
include ../test_common.mk
|
||||
include ../../common/Makefile
|
||||
|
|
@ -6,7 +6,7 @@
|
|||
#include <termios.h>
|
||||
#include <pty.h>
|
||||
#include <poll.h>
|
||||
#include "../test.h"
|
||||
#include "../../common/test.h"
|
||||
|
||||
int master;
|
||||
int slave;
|
||||
|
|
@ -9,7 +9,7 @@
|
|||
#include <pty.h>
|
||||
#include <poll.h>
|
||||
#include <sys/wait.h>
|
||||
#include "../test.h"
|
||||
#include "../../common/test.h"
|
||||
|
||||
#define DEV_PTMX "/dev/ptmx"
|
||||
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
// SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
#include "../test.h"
|
||||
#include "../../common/test.h"
|
||||
|
||||
#include <pthread.h>
|
||||
#include <pty.h>
|
||||
|
|
@ -8,7 +8,7 @@
|
|||
#include <termios.h>
|
||||
#include <pty.h>
|
||||
#include <poll.h>
|
||||
#include "../test.h"
|
||||
#include "../../common/test.h"
|
||||
|
||||
int master;
|
||||
int slave;
|
||||
|
|
@ -3,7 +3,7 @@
|
|||
#include <unistd.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/fcntl.h>
|
||||
#include "../test.h"
|
||||
#include "../common/test.h"
|
||||
|
||||
#define PAGE_SIZE 4096
|
||||
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
#!/bin/sh
|
||||
|
||||
# SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
set -e
|
||||
|
||||
./pty/close_pty
|
||||
./pty/open_ptmx
|
||||
./pty/open_pty
|
||||
./pty/pty_blocking
|
||||
./pty/pty_packet_mode
|
||||
./evdev
|
||||
./framebuffer
|
||||
./full
|
||||
./random
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
# SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
include ../test_common.mk
|
||||
|
||||
EXTRA_C_FLAGS :=
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
# SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
include ../test_common.mk
|
||||
|
||||
EXTRA_C_FLAGS :=
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
# SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
include ../test_common.mk
|
||||
|
||||
EXTRA_C_FLAGS := -static
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
# SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
SUBDIRS := \
|
||||
chroot \
|
||||
ext2 \
|
||||
fdatasync \
|
||||
inotify \
|
||||
overlayfs \
|
||||
procfs \
|
||||
pseudofs \
|
||||
|
||||
include ../common/Makefile
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
# SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
include ../../common/Makefile
|
||||
|
|
@ -15,7 +15,7 @@
|
|||
#include <sys/wait.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "../test.h"
|
||||
#include "../../common/test.h"
|
||||
|
||||
FN_SETUP(create_chroot_env)
|
||||
{
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
# SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
include ../../common/Makefile
|
||||
|
|
@ -9,7 +9,7 @@
|
|||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/sysmacros.h>
|
||||
#include "../test.h"
|
||||
#include "../../common/test.h"
|
||||
|
||||
#define NULL_DEVICE_PATH "/ext2/my_null_device"
|
||||
#define ZERO_DEVICE_PATH "/ext2/my_zero_device"
|
||||
|
|
@ -8,7 +8,7 @@
|
|||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/un.h>
|
||||
#include "../test.h"
|
||||
#include "../../common/test.h"
|
||||
|
||||
#define SERVER_ADDRESS "/ext2/my_unix_server"
|
||||
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
# SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
include ../../common/Makefile
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
# SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
include ../../common/Makefile
|
||||
|
|
@ -3,7 +3,7 @@
|
|||
#include <sys/inotify.h>
|
||||
#include <sys/fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include "../test.h"
|
||||
#include "../../common/test.h"
|
||||
|
||||
#define TEST_FILE "/tmp/test1"
|
||||
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
# SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
include ../../common/Makefile
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
# SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
include ../../common/Makefile
|
||||
|
|
@ -6,7 +6,7 @@
|
|||
#include <fcntl.h>
|
||||
#include <wait.h>
|
||||
|
||||
#include "../test.h"
|
||||
#include "../../common/test.h"
|
||||
|
||||
FN_TEST(negative_cache_pid)
|
||||
{
|
||||
|
|
@ -12,7 +12,7 @@
|
|||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "../test.h"
|
||||
#include "../../common/test.h"
|
||||
|
||||
#define PAGE_SIZE 4096
|
||||
#define ORIG_STR "ORIGINAL"
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
# SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
include ../../common/Makefile
|
||||
|
|
@ -12,7 +12,7 @@
|
|||
#include <sys/ioctl.h>
|
||||
#include <linux/fs.h>
|
||||
|
||||
#include "../test.h"
|
||||
#include "../../common/test.h"
|
||||
|
||||
char memfd_path[64];
|
||||
|
||||
|
|
@ -19,7 +19,7 @@
|
|||
#include <sys/mman.h>
|
||||
#include <signal.h>
|
||||
|
||||
#include "../test.h"
|
||||
#include "../../common/test.h"
|
||||
|
||||
int pipe_1[2], pipe_2[2];
|
||||
int sock[2];
|
||||
|
|
@ -3,7 +3,6 @@
|
|||
# SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
set -e
|
||||
set -x
|
||||
|
||||
check_file_size() {
|
||||
local file_name="$1"
|
||||
|
|
@ -45,11 +44,11 @@ test_ext2() {
|
|||
}
|
||||
|
||||
test_fdatasync() {
|
||||
fdatasync/fdatasync /
|
||||
./fdatasync/fdatasync /
|
||||
rm -f /test_fdatasync.txt
|
||||
fdatasync/fdatasync /ext2
|
||||
./fdatasync/fdatasync /ext2
|
||||
rm -f /ext2/test_fdatasync.txt
|
||||
fdatasync/fdatasync /exfat
|
||||
./fdatasync/fdatasync /exfat
|
||||
rm -f /exfat/test_fdatasync.txt
|
||||
}
|
||||
|
||||
|
|
@ -88,8 +87,8 @@ test_mount_bind_file() {
|
|||
|
||||
echo "Start ext2 fs test......"
|
||||
test_ext2 "/ext2" "test_file.txt"
|
||||
ext2/mknod
|
||||
ext2/unix_socket
|
||||
./ext2/mknod
|
||||
./ext2/unix_socket
|
||||
echo "All ext2 fs test passed."
|
||||
|
||||
echo "Start fdatasync test......"
|
||||
|
|
@ -100,14 +99,16 @@ echo "Start mount bind file test......"
|
|||
test_mount_bind_file
|
||||
echo "All mount bind file test passed."
|
||||
|
||||
pipe/pipe_err
|
||||
pipe/short_rw
|
||||
epoll/epoll_err
|
||||
epoll/poll_err
|
||||
file_io/access_err
|
||||
file_io/file_err
|
||||
file_io/iovec_err
|
||||
devfs/full
|
||||
devfs/random
|
||||
devfs/framebuffer
|
||||
devfs/evdev
|
||||
./inotify/inotify_align
|
||||
./inotify/inotify_poll
|
||||
./inotify/inotify_unlink
|
||||
|
||||
./overlayfs/ovl_test
|
||||
|
||||
./procfs/dentry_cache
|
||||
./procfs/pid_mem
|
||||
|
||||
./pseudofs/memfd_access_err
|
||||
./pseudofs/pseudo_dentry
|
||||
./pseudofs/pseudo_inode
|
||||
./pseudofs/pseudo_mount
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
# SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
include ../test_common.mk
|
||||
|
||||
EXTRA_C_FLAGS :=
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
# SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
include ../test_common.mk
|
||||
|
||||
EXTRA_C_FLAGS :=
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
# SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
include ../test_common.mk
|
||||
|
||||
EXTRA_C_FLAGS := -static -mno-sse
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
# SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
include ../test_common.mk
|
||||
|
||||
EXTRA_C_FLAGS :=
|
||||
|
|
@ -1,5 +1,11 @@
|
|||
# SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
include ../test_common.mk
|
||||
SUBDIRS := \
|
||||
in_c \
|
||||
in_c_pie \
|
||||
|
||||
EXTRA_C_FLAGS := -static -nostdlib
|
||||
ifeq ($(HOST_PLATFORM), x86_64-linux)
|
||||
SUBDIRS += in_assembly
|
||||
endif
|
||||
|
||||
include ../common/Makefile
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
# SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
include ../test_common.mk
|
||||
|
||||
EXTRA_C_FLAGS := -static -nostdlib
|
||||
|
||||
include ../../common/Makefile
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
# SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
include ../test_common.mk
|
||||
|
||||
EXTRA_C_FLAGS := -static
|
||||
|
||||
include ../../common/Makefile
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
# SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
include ../../common/Makefile
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
#!/bin/sh
|
||||
|
||||
# SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
set -e
|
||||
|
||||
./in_c/hello
|
||||
./in_c_pie/hello
|
||||
[ "$(uname -m)" = "x86_64" ] && ./in_assembly/hello
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
# SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
include ../test_common.mk
|
||||
|
||||
EXTRA_C_FLAGS :=
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
# SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
SUBDIRS := gen_quote
|
||||
|
||||
include ../common/Makefile
|
||||
|
|
@ -1,27 +1,26 @@
|
|||
# SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
MAIN_MAKEFILE := $(firstword $(MAKEFILE_LIST))
|
||||
INCLUDE_MAKEFILE := $(lastword $(MAKEFILE_LIST))
|
||||
CUR_DIR := $(shell dirname $(realpath $(MAIN_MAKEFILE)))
|
||||
CUR_DIR_NAME := $(shell basename $(realpath $(CUR_DIR)))
|
||||
CUR_DIR := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
|
||||
ATOMIC_WGET := $(CUR_DIR)/../../../../../../tools/atomic_wget.sh
|
||||
BUILD_DIR ?= $(CUR_DIR)/../../../../build
|
||||
OUTPUT_DIR ?= $(BUILD_DIR)/initramfs/test
|
||||
BIN_OUTPUT_DIR := $(OUTPUT_DIR)/intel_tdx/gen_quote
|
||||
TDX_ATTEST_DIR ?= $(CUR_DIR)
|
||||
TDX_SRCS := test_tdx_attest.c tdx_attest.c qgs_msg_lib.cpp
|
||||
BUILD_DIR := $(CUR_DIR)/../../../build
|
||||
OBJ_OUTPUT_DIR := $(BUILD_DIR)/initramfs/test/$(CUR_DIR_NAME)
|
||||
CC ?= gcc
|
||||
C_FLAGS ?= -Wall -Werror
|
||||
# FIXME: Disable use-after-free warning as error due to potential false positive
|
||||
# in realloc/free pattern in `tdx_attest.c`.
|
||||
C_FLAGS += -Wno-error
|
||||
DCAP_VERSION := DCAP_1.23
|
||||
DCAP_URL_PREFIX := "https://github.com/intel/SGXDataCenterAttestationPrimitives/raw/$(DCAP_VERSION)/QuoteGeneration/quote_wrapper"
|
||||
ATOMIC_WGET := $(CUR_DIR)/../../../../tools/atomic_wget.sh
|
||||
|
||||
.PHONY: all
|
||||
all: $(BIN_OUTPUT_DIR)/gen_quote
|
||||
|
||||
all: $(OBJ_OUTPUT_DIR) $(OBJ_OUTPUT_DIR)/generate_tdx_quote
|
||||
$(BIN_OUTPUT_DIR):
|
||||
@mkdir -p $@
|
||||
|
||||
$(OBJ_OUTPUT_DIR):
|
||||
@mkdir -p $(OBJ_OUTPUT_DIR)
|
||||
|
||||
$(OBJ_OUTPUT_DIR)/generate_tdx_quote: $(addprefix $(TDX_ATTEST_DIR)/,$(TDX_SRCS))
|
||||
$(BIN_OUTPUT_DIR)/gen_quote: $(addprefix $(TDX_ATTEST_DIR)/,$(TDX_SRCS)) | $(BIN_OUTPUT_DIR)
|
||||
@$(CC) $(C_FLAGS) $^ -o $@
|
||||
@echo "CC <= $@"
|
||||
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
#!/bin/sh
|
||||
|
||||
# SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
set -e
|
||||
|
||||
if [ -e /dev/tdx_guest ]; then
|
||||
./gen_quote/gen_quote
|
||||
fi
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
# SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
SUBDIRS := \
|
||||
epoll \
|
||||
eventfd2 \
|
||||
file_io \
|
||||
|
||||
include ../common/Makefile
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
# SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
include ../../common/Makefile
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
// SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
#include "../test.h"
|
||||
#include "../../common/test.h"
|
||||
#include <unistd.h>
|
||||
#include <sys/epoll.h>
|
||||
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
// SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
#include "../test.h"
|
||||
#include "../../common/test.h"
|
||||
#include <unistd.h>
|
||||
#include <sys/poll.h>
|
||||
|
||||
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
set -e
|
||||
|
||||
EPOLLTEST_DIR=/test/epoll
|
||||
EPOLLTEST_DIR=/test/io/epoll
|
||||
cd ${EPOLLTEST_DIR}
|
||||
|
||||
echo "Start epoll_pwait test......"
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
# SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
include ../../common/Makefile
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
# SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
include ../test_common.mk
|
||||
|
||||
EXTRA_C_FLAGS := -Wno-incompatible-pointer-types
|
||||
|
||||
include ../../common/Makefile
|
||||
|
|
@ -9,7 +9,7 @@
|
|||
#include <sys/file.h>
|
||||
#include <poll.h>
|
||||
|
||||
#include "../test.h"
|
||||
#include "../../common/test.h"
|
||||
|
||||
#define FILENAME "/tmp/testfile"
|
||||
#define DIRNAME "/tmp"
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
#define _GNU_SOURCE
|
||||
|
||||
#include "../test.h"
|
||||
#include "../../common/test.h"
|
||||
#include <stdint.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
|
|
@ -6,7 +6,7 @@
|
|||
#include <sys/uio.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "../test.h"
|
||||
#include "../../common/test.h"
|
||||
|
||||
static char buf[16];
|
||||
static struct iovec iov_long[UIO_MAXIOV + 2];
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
#!/bin/sh
|
||||
|
||||
# SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
set -e
|
||||
|
||||
./epoll/epoll_err
|
||||
./epoll/poll_err
|
||||
./epoll/test_epoll_pwait.sh
|
||||
|
||||
./eventfd2/eventfd2
|
||||
|
||||
./file_io/access_err
|
||||
./file_io/file_err
|
||||
./file_io/iovec_err
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
# SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
SUBDIRS := \
|
||||
pipe \
|
||||
shm \
|
||||
|
||||
include ../common/Makefile
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
# SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
include ../../common/Makefile
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
#define _GNU_SOURCE
|
||||
|
||||
#include "../test.h"
|
||||
#include "../../common/test.h"
|
||||
#include <signal.h>
|
||||
#include <string.h>
|
||||
#include <sys/poll.h>
|
||||
|
|
@ -4,7 +4,7 @@
|
|||
#include <sys/mman.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "../test.h"
|
||||
#include "../../common/test.h"
|
||||
|
||||
#define PAGE_SIZE 4096
|
||||
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
#!/bin/sh
|
||||
|
||||
# SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
set -e
|
||||
|
||||
./pipe/pipe_err
|
||||
./pipe/short_rw
|
||||
|
||||
./shm/posix_shm
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
# SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
include ../../common/Makefile
|
||||
|
|
@ -63,7 +63,7 @@ int producer_process()
|
|||
if (child_pid < 0) {
|
||||
THROW_ERROR("Spawn a child process failed");
|
||||
} else if (child_pid == 0) {
|
||||
execl("/test/shm/posix_shm", "posix_shm", "consumer", NULL);
|
||||
execl("/test/ipc/shm/posix_shm", "posix_shm", "consumer", NULL);
|
||||
THROW_ERROR("exec failed");
|
||||
}
|
||||
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
# SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
include ../test_common.mk
|
||||
|
||||
EXTRA_C_FLAGS :=
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
# SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
SUBDIRS := \
|
||||
mmap \
|
||||
|
||||
include ../common/Makefile
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
# SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
include ../../common/Makefile
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue