Skip to content

Commit

Permalink
distro-tester: external runners
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaeldtinoco committed May 19, 2022
1 parent 6133afa commit 6fdd72b
Show file tree
Hide file tree
Showing 11 changed files with 53 additions and 35 deletions.
27 changes: 15 additions & 12 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ jobs:
# Test: TRC-2 with selected kernels.
#
CO-RE:
runs-on: ubuntu-20.04
runs-on: self-hosted
needs:
- smoke-test-core
strategy:
Expand All @@ -225,20 +225,21 @@ jobs:
uses: actions/checkout@v2
with:
submodules: true
- name: "Pull test container image"
run: |
distro=$(echo ${{ matrix.distro }} | cut -d'-' -f1)
docker image pull rafaeldtinoco/tracee-distro-tester:$distro
#- name: "Pull test container image"
# run: |
# distro=$(echo ${{ matrix.distro }} | cut -d'-' -f1)
# docker image pull rafaeldtinoco/tracee-distro-tester:$distro
- name: "Run tests"
run: |
distro=$(echo ${{ matrix.distro }} | cut -d'-' -f1)
docker run --rm --privileged -v $(pwd):/tracee:rw \
-e kvm_accel="tcg" \
-e kvm_accel="kvm" \
-e test_name=${{ matrix.signature }} \
-e non_core=0 \
-e cpus=8 -e mem=4 \
-t rafaeldtinoco/tracee-distro-tester:$distro
NON-CO-RE:
runs-on: ubuntu-20.04
runs-on: self-hosted
needs:
- smoke-test-noncore
strategy:
Expand All @@ -260,15 +261,17 @@ jobs:
uses: actions/checkout@v2
with:
submodules: true
- name: "Pull test container image"
run: |
distro=$(echo ${{ matrix.distro }} | cut -d'-' -f1)
docker image pull rafaeldtinoco/tracee-distro-tester:$distro
#- name: "Pull test container image"
# run: |
# distro=$(echo ${{ matrix.distro }} | cut -d'-' -f1)
# docker image pull rafaeldtinoco/tracee-distro-tester:$distro
- name: "Run tests"
run: |
distro=$(echo ${{ matrix.distro }} | cut -d'-' -f1)
docker run --rm --privileged -v $(pwd):/tracee:rw \
-e kvm_accel="tcg" \
-e kvm_accel="kvm" \
-e test_name=${{ matrix.signature }} \
-e non_core=1 \
-e cpus=8 -e mem=4 \
-t rafaeldtinoco/tracee-distro-tester:$distro
13 changes: 7 additions & 6 deletions .github/workflows/test-core-weekly.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
- cron: '0 4 * * 6'
jobs:
CO-RE:
runs-on: ubuntu-20.04
runs-on: self-hosted
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -39,15 +39,16 @@ jobs:
uses: actions/checkout@v2
with:
submodules: true
- name: "Pull test container image"
run: |
distro=$(echo ${{ matrix.distro }} | cut -d'-' -f1)
docker image pull rafaeldtinoco/tracee-distro-tester:$distro
#- name: "Pull test container image"
# run: |
# distro=$(echo ${{ matrix.distro }} | cut -d'-' -f1)
# docker image pull rafaeldtinoco/tracee-distro-tester:$distro
- name: "Run tests"
run: |
distro=$(echo ${{ matrix.distro }} | cut -d'-' -f1)
docker run --rm --privileged -v $(pwd):/tracee:rw \
-e kvm_accel="tcg" \
-e kvm_accel="kvm" \
-e test_name=${{ matrix.signature }} \
-e non_core=0 \
-e cpus=8 -e mem=4 \
-t rafaeldtinoco/tracee-distro-tester:$distro
13 changes: 7 additions & 6 deletions .github/workflows/test-noncore-weekly.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
- cron: '0 6 * * 6'
jobs:
NON-CO-RE:
runs-on: ubuntu-20.04
runs-on: self-hosted
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -39,15 +39,16 @@ jobs:
uses: actions/checkout@v2
with:
submodules: true
- name: "Pull test container image"
run: |
distro=$(echo ${{ matrix.distro }} | cut -d'-' -f1)
docker image pull rafaeldtinoco/tracee-distro-tester:$distro
#- name: "Pull test container image"
# run: |
# distro=$(echo ${{ matrix.distro }} | cut -d'-' -f1)
# docker image pull rafaeldtinoco/tracee-distro-tester:$distro
- name: "Run tests"
run: |
distro=$(echo ${{ matrix.distro }} | cut -d'-' -f1)
docker run --rm --privileged -v $(pwd):/tracee:rw \
-e kvm_accel="tcg" \
-e kvm_accel="kvm" \
-e test_name=${{ matrix.signature }} \
-e non_core=1 \
-e cpus=8 -e mem=4 \
-t rafaeldtinoco/tracee-distro-tester:$distro
4 changes: 0 additions & 4 deletions tests/distro-tester/.gitignore

This file was deleted.

24 changes: 18 additions & 6 deletions tests/distro-tester/03-run-qemu.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash -ex

# syntax: ./$0 [image] [tracee_dir] [TRC-X] [kvm|tcg] [0|1]
# syntax: ./$0 [image] [tracee_dir] [TRC-X] [kvm|tcg] [0|1] [cpus] [memory]

. ./00-config

Expand All @@ -12,6 +12,8 @@ tracee=$2
testname=$3
kvmaccel=$4
isnoncore=$5
cpus=$6 # optional
mem=$7 # optional

qemu-img info images/$image | grep -q raw && format="raw"
qemu-img info images/$image | grep -q qcow2 && format="qcow2"
Expand All @@ -21,7 +23,7 @@ error_syntax() {
echo -n "ERROR: "
echo $@
echo ""
echo "syntax: $0 [image] [tracee_dir] [TRC-X] [kvm|tcg]"
echo "syntax: $0 [image] [tracee_dir] [TRC-X] [kvm|tcg] [0|1] [cpus] [memory]"
echo ""
exit 1
}
Expand All @@ -42,10 +44,20 @@ if [[ $kvmaccel != tcg && $kvmaccel != kvm ]]; then
error_syntax "acceleration should be tcg or kvm"
fi

if [[ $isnoncore == "" || ( $isnoncore -ne 0 && $isnoncore -ne 1 ) ]]; then
if [[ $isnoncore -ne 0 && $isnoncore -ne 1 ]]; then
error_syntax "non core should be either 0 or 1"
fi

# amount of vpus
if [[ $cpus -ne 2 && $cpus -ne 4 && $cpus -ne 6 && $cpus -ne 8 ]]; then
error_syntax "should provide amount of cpus"
fi

# amount of memory
if [[ $mem -ne 2 && $mem -ne 4 && $mem -ne 6 && $mem -ne 8 ]]; then
error_syntax "should provide amount of mem"
fi

mount -t tmpfs -o rw,nosuid,nodev,inode64 tmpfs /dev/shm

rm -f "/tmp/vhostqemu-$image"
Expand Down Expand Up @@ -74,9 +86,9 @@ fi
qemu-system-x86_64 \
-name guest=$image \
-machine accel=$kvmaccel \
--cpu max --smp cpus=1 -m 2G \
-object memory-backend-file,id=mem,size=2G,mem-path=/dev/shm,share=on \
-numa node,nodeid=0,cpus=0,memdev=mem \
--cpu max --smp $cpus -m ${mem}G \
-object memory-backend-file,id=mem,size=${mem}G,mem-path=/dev/shm,share=on \
-numa node,nodeid=0,memdev=mem \
-rtc base=utc,clock=vm,driftfix=none \
-boot c \
-display none \
Expand Down
2 changes: 1 addition & 1 deletion tests/distro-tester/files/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,6 @@ fi

cd /tester

./03-run-qemu.sh $image_name /tracee $test_name $kvm_accel $non_core | tee /tmp/qemu.log
./03-run-qemu.sh $image_name /tracee $test_name $kvm_accel $non_core $cpus $mem | tee /tmp/qemu.log

# vi:syntax=sh:expandtab:smarttab:tabstop=2:shiftwidth=2:softtabstop=2
Expand Down
1 change: 1 addition & 0 deletions tests/distro-tester/images-copy/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*
1 change: 1 addition & 0 deletions tests/distro-tester/images-full/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*
1 change: 1 addition & 0 deletions tests/distro-tester/images/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*
1 change: 1 addition & 0 deletions tests/distro-tester/kernels-copy/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*
1 change: 1 addition & 0 deletions tests/distro-tester/kernels/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*

0 comments on commit 6fdd72b

Please sign in to comment.