From d2bb6749c8e7f84ed2aef3a22b438d4913481a43 Mon Sep 17 00:00:00 2001 From: Melissa Kilby Date: Wed, 5 Jun 2024 22:17:49 +0000 Subject: [PATCH] chore: update test/vm setup Signed-off-by: Melissa Kilby --- test/README.md | 5 +++-- test/vm/CMakeLists.txt | 4 ++-- test/vm/containers/debianbuster.Dockerfile | 5 +---- ...untu2310.Dockerfile => ubuntu2404.Dockerfile} | 16 +++++++++------- test/vm/kernels.jsonl | 1 + test/vm/scripts/compile_drivers.sh | 8 ++++---- test/vm/scripts/main.go | 8 ++++---- test/vm/scripts/vm_compile.sh | 7 ++++--- 8 files changed, 28 insertions(+), 26 deletions(-) rename test/vm/containers/{ubuntu2310.Dockerfile => ubuntu2404.Dockerfile} (87%) diff --git a/test/README.md b/test/README.md index b8944ad41f..930605ded2 100644 --- a/test/README.md +++ b/test/README.md @@ -3,7 +3,8 @@ Home of falcosecurity/libs test suites. In addition, you can find more traditional unit tests in the respective subfolder of each module within the code base. - [drivers](drivers/): run unit tests against each driver (kmod, bpf, modern_bpf) +- [e2e](e2e/): e2e libs sinsp functionality tests (Python module) - [libscap](libscap/): libscap unit tests -- [e2e](e2e/): e2e libs sinsp functionality tests -- [vm](vm/): VM based kernel compatibility and functionality tests +- [libsinsp_e2e](libsinsp_e2e/): additional / new e2e libsinsp functionality tests (C++ module) +- [vm](vm/): VM based kernel compatibility and functionality tests using vagrant (localhost test use cases) diff --git a/test/vm/CMakeLists.txt b/test/vm/CMakeLists.txt index 40ce6fab71..08775186bb 100644 --- a/test/vm/CMakeLists.txt +++ b/test/vm/CMakeLists.txt @@ -1,6 +1,6 @@ set(UBUNTU_CONTAINER1 "vm-ubuntu2004:latest") set(UBUNTU_CONTAINER2 "vm-ubuntu2204:latest") -set(UBUNTU_CONTAINER3 "vm-ubuntu2310:latest") +set(UBUNTU_CONTAINER3 "vm-ubuntu2404:latest") set(DEBIANBUSTER_CONTAINER "vm-debianbuster:latest") # TODO In case we have an equivalent upstream supported container, remove the custom modern-falco-builder set(MODERN_FALCO_BUILDER_CONTAINER "modern-falco-builder:latest") @@ -25,7 +25,7 @@ add_custom_target(vm-dependency-check add_custom_target(vm-container COMMAND time docker build -f ${CMAKE_CURRENT_SOURCE_DIR}/containers/ubuntu2004.Dockerfile -t ${UBUNTU_CONTAINER1} .; COMMAND time docker build -f ${CMAKE_CURRENT_SOURCE_DIR}/containers/ubuntu2204.Dockerfile -t ${UBUNTU_CONTAINER2} .; - COMMAND time docker build -f ${CMAKE_CURRENT_SOURCE_DIR}/containers/ubuntu2310.Dockerfile -t ${UBUNTU_CONTAINER3} .; + COMMAND time docker build -f ${CMAKE_CURRENT_SOURCE_DIR}/containers/ubuntu2404.Dockerfile -t ${UBUNTU_CONTAINER3} .; COMMAND time docker build -f ${CMAKE_CURRENT_SOURCE_DIR}/containers/debianbuster.Dockerfile -t ${DEBIANBUSTER_CONTAINER} .; COMMAND time docker build -f ${CMAKE_CURRENT_SOURCE_DIR}/containers/modern-falco-builder.Dockerfile -t ${MODERN_FALCO_BUILDER_CONTAINER} .; ) diff --git a/test/vm/containers/debianbuster.Dockerfile b/test/vm/containers/debianbuster.Dockerfile index 7721b0d2df..c0c42f3e59 100644 --- a/test/vm/containers/debianbuster.Dockerfile +++ b/test/vm/containers/debianbuster.Dockerfile @@ -7,7 +7,6 @@ ARG TARGETARCH=amd64 ARG CMAKE_VERSION=3.22.5 RUN cp /etc/skel/.bashrc /root && cp /etc/skel/.profile /root -RUN echo 'deb http://deb.debian.org/debian buster-backports main' >>/etc/apt/sources.list RUN apt-get update \ && apt-get install -y --no-install-recommends \ @@ -18,7 +17,6 @@ RUN apt-get update \ ca-certificates \ curl \ dkms \ - dwarves/buster-backports \ gnupg2 \ gcc \ jq \ @@ -43,8 +41,7 @@ RUN apt-get update \ zstd \ gawk \ mawk \ - git \ - && rm -rf /var/lib/apt/lists/* + git RUN if [ "$TARGETARCH" = "amd64" ] ; then apt-get install -y --no-install-recommends libmpx2; fi diff --git a/test/vm/containers/ubuntu2310.Dockerfile b/test/vm/containers/ubuntu2404.Dockerfile similarity index 87% rename from test/vm/containers/ubuntu2310.Dockerfile rename to test/vm/containers/ubuntu2404.Dockerfile index d5605bb23a..5e233b08c6 100644 --- a/test/vm/containers/ubuntu2310.Dockerfile +++ b/test/vm/containers/ubuntu2404.Dockerfile @@ -1,4 +1,4 @@ -FROM docker.io/library/ubuntu:23.10 +FROM docker.io/library/ubuntu:24.04 LABEL maintainer="cncf-falco-dev@lists.cncf.io" @@ -49,18 +49,20 @@ RUN apt --fix-broken -y install && apt-get install -y \ gcc-10 \ gcc-11 \ gcc-12 \ - llvm-13 \ - clang-13 \ gcc-13 \ llvm-14 \ clang-14 \ llvm-15 \ clang-15 \ llvm-16 \ - clang-16 + clang-16 \ + llvm-17 \ + clang-17 \ + llvm-18 \ + clang-18 -RUN update-alternatives --install /usr/bin/clang clang /usr/bin/clang-15 90 -RUN update-alternatives --install /usr/bin/llvm-strip llvm-strip /usr/bin/llvm-strip-15 90 +RUN update-alternatives --install /usr/bin/clang clang /usr/bin/clang-16 90 +RUN update-alternatives --install /usr/bin/llvm-strip llvm-strip /usr/bin/llvm-strip-16 90 RUN git clone https://github.com/libbpf/bpftool.git --branch v7.2.0 --single-branch && cd bpftool && git submodule update --init && cd src && make && make install -ENTRYPOINT ["/bin/bash", "-c"] +ENTRYPOINT ["/bin/bash", "-c"] \ No newline at end of file diff --git a/test/vm/kernels.jsonl b/test/vm/kernels.jsonl index 1dad66498a..b769de3756 100644 --- a/test/vm/kernels.jsonl +++ b/test/vm/kernels.jsonl @@ -5,6 +5,7 @@ {"headers": ["https://linux.cc.iitk.ac.in/mirror/centos/elrepo/kernel/el7/x86_64/RPMS/kernel-ml-devel-5.10.9-1.el7.elrepo.x86_64.rpm"], "kernels": ["https://linux.cc.iitk.ac.in/mirror/centos/elrepo/kernel/el7/x86_64/RPMS/kernel-ml-5.10.9-1.el7.elrepo.x86_64.rpm"]} {"headers": ["https://linux.cc.iitk.ac.in/mirror/centos/elrepo/kernel/el7/x86_64/RPMS/kernel-ml-devel-5.14.15-1.el7.elrepo.x86_64.rpm"], "kernels": ["https://linux.cc.iitk.ac.in/mirror/centos/elrepo/kernel/el7/x86_64/RPMS/kernel-ml-5.14.15-1.el7.elrepo.x86_64.rpm"]} {"headers": ["https://linux.cc.iitk.ac.in/mirror/centos/elrepo/kernel/el7/x86_64/RPMS/kernel-ml-devel-6.5.8-1.el7.elrepo.x86_64.rpm"], "kernels": ["https://linux.cc.iitk.ac.in/mirror/centos/elrepo/kernel/el7/x86_64/RPMS/kernel-ml-6.5.8-1.el7.elrepo.x86_64.rpm"]} +{"headers": ["https://linux.cc.iitk.ac.in/mirror/centos/elrepo/kernel/el7/x86_64/RPMS/kernel-ml-devel-6.9.3-1.el7.elrepo.x86_64.rpm"], "kernels": ["https://linux.cc.iitk.ac.in/mirror/centos/elrepo/kernel/el7/x86_64/RPMS/kernel-ml-6.9.3-1.el7.elrepo.x86_64.rpm"]} {"headers": ["https://kernel.ubuntu.com/mainline/v4.16.18/linux-headers-4.16.18-041618-generic_4.16.18-041618.201806252030_amd64.deb", "https://kernel.ubuntu.com/mainline/v4.16.18/linux-headers-4.16.18-041618_4.16.18-041618.201806252030_all.deb"], "kernels": ["https://kernel.ubuntu.com/mainline/v4.16.18/linux-image-unsigned-4.16.18-041618-generic_4.16.18-041618.201806252030_amd64.deb", "https://kernel.ubuntu.com/mainline/v4.16.18/linux-modules-4.16.18-041618-generic_4.16.18-041618.201806252030_amd64.deb"]} {"headers": ["https://kernel.ubuntu.com/mainline/v4.19.296/amd64/linux-headers-4.19.296-0419296-generic_4.19.296-0419296.202310101642_amd64.deb", "https://kernel.ubuntu.com/mainline/v4.19.296/amd64/linux-headers-4.19.296-0419296_4.19.296-0419296.202310101642_all.deb"], "kernels": ["https://kernel.ubuntu.com/mainline/v4.19.296/amd64/linux-image-unsigned-4.19.296-0419296-generic_4.19.296-0419296.202310101642_amd64.deb", "https://kernel.ubuntu.com/mainline/v4.19.296/amd64/linux-modules-4.19.296-0419296-generic_4.19.296-0419296.202310101642_amd64.deb"]} {"headers": ["https://kernel.ubuntu.com/mainline/v5.19.17/amd64/linux-headers-5.19.17-051917-generic_5.19.17-051917.202210240939_amd64.deb", "https://kernel.ubuntu.com/mainline/v5.19.17/amd64/linux-headers-5.19.17-051917_5.19.17-051917.202210240939_all.deb"], "kernels": ["https://kernel.ubuntu.com/mainline/v5.19.17/amd64/linux-image-unsigned-5.19.17-051917-generic_5.19.17-051917.202210240939_amd64.deb", "https://kernel.ubuntu.com/mainline/v5.19.17/amd64/linux-modules-5.19.17-051917-generic_5.19.17-051917.202210240939_amd64.deb"]} diff --git a/test/vm/scripts/compile_drivers.sh b/test/vm/scripts/compile_drivers.sh index 1c02963066..1ba9a17d5b 100755 --- a/test/vm/scripts/compile_drivers.sh +++ b/test/vm/scripts/compile_drivers.sh @@ -16,8 +16,8 @@ if [[ ! -f ${LIBS_TAR_GZ} ]]; then exit 1 fi -LLC="${1}"; # only needed for eBPF -CLANG="${2}"; # only needed for eBPF +export LLC="${1}"; # only needed for eBPF +export CLANG="${2}"; # only needed for eBPF GCC="${3}"; # only needed for kmod KMOD="${4}"; BPF="${5}"; @@ -70,9 +70,9 @@ for d in "${DIR_EXTRACTED_KERNEL_HEADERS_SUB_DIRS}"/*; do if [[ "${BPF}" == *"ON"* ]]; then printf "\n\n[STATUS] IN PROGRESS bpf ${KERNEL_UNAME_R} w/ ${CLANG_VERSION}\n\n"; - "${CLANG}" --version; + ${CLANG} --version; rm -f "${LIBS_DIR}/build/driver/bpf/probe.o"; - make LLC="${LLC}" CLANG="${CLANG}" \ + make LLC=${LLC} CLANG=${CLANG} \ KERNELDIR=${SOURCES} -B -C "${LIBS_DIR}/build/driver/bpf" || true if [[ -f "${LIBS_DIR}/build/driver/bpf/probe.o" ]]; then diff --git a/test/vm/scripts/main.go b/test/vm/scripts/main.go index 985218f78f..1427eef27e 100644 --- a/test/vm/scripts/main.go +++ b/test/vm/scripts/main.go @@ -18,7 +18,7 @@ var ( sem = semaphore.NewWeighted(int64(maxWorkers)) ubuntuContainer2004 = "vm-ubuntu2004:latest" ubuntuContainer2204 = "vm-ubuntu2204:latest" - ubuntuContainer2310 = "vm-ubuntu2310:latest" + ubuntuContainer2404 = "vm-ubuntu2404:latest" debianbusterContainer = "vm-debianbuster:latest" ) @@ -35,14 +35,14 @@ func dockerRunCompileDriver(ctx context.Context, ver [2]string, headers string, if verNumeric >= 11 { dockerImage = ubuntuContainer2204 } - if verNumeric >= 15 { - dockerImage = ubuntuContainer2310 + if verNumeric >= 14 { + dockerImage = ubuntuContainer2404 } shArgs = []string{"-c", fmt.Sprintf("docker run -v %s:/vm:z -v %s:/headers:z %s \"/bin/bash /vm/scripts/compile_drivers.sh /usr/bin/llc-%d /usr/bin/clang-%d /usr/bin/gcc-%d OFF ON\"", dir, headers, dockerImage, verNumeric, verNumeric, verNumeric)} } else if compilerType == "gcc" { dockerImage = debianbusterContainer if verNumeric >= 9 { - dockerImage = ubuntuContainer2310 + dockerImage = ubuntuContainer2404 } shArgs = []string{"-c", fmt.Sprintf("docker run -v %s:/vm:z -v %s:/headers:z %s \"/bin/bash /vm/scripts/compile_drivers.sh /usr/bin/llc-%d /usr/bin/clang-%d /usr/bin/gcc-%d ON OFF\"", dir, headers, dockerImage, verNumeric, verNumeric, verNumeric)} } diff --git a/test/vm/scripts/vm_compile.sh b/test/vm/scripts/vm_compile.sh index df9b539656..cd819154f4 100755 --- a/test/vm/scripts/vm_compile.sh +++ b/test/vm/scripts/vm_compile.sh @@ -35,11 +35,12 @@ rm -rf ${BASE_DIR}/build/driver || true; rm -rf ${BASE_DIR}/build/driver_ok || true; # You have the option to customize the args to the Go launcher script -# -compilerVersionsClang=15 -# -compilerVersionsClang=7,9,10,12,14,15,16 +# -compilerVersionsClang="15" +# -compilerVersionsClang="7,8,9,10,11,12,13,14,15,16,17,18" # -compilerVersionsGcc="" +# -compilerVersionsGcc="9,10,11,12,13" GO111MODULE=off BASE_DIR=${BASE_DIR} bash -c 'go get golang.org/x/sync/semaphore; \ -go run ${BASE_DIR}/scripts/main.go -compilerVersionsClang=7,12,14,16 -compilerVersionsGcc=5,9,11,13 \ +go run ${BASE_DIR}/scripts/main.go -compilerVersionsClang="7,12,14,16,18" -compilerVersionsGcc="9,12,13" \ -dirExtractedKernelHeaders=${BASE_DIR}/build/headers_extracted/ -dir=${BASE_DIR}' printf "\n\n[STATUS] Build scap-open userspace binary using build/libs-src.tar.gz as libs source\n\n";