From 6fdd72b42d8ab9af619aa8e984afb6241bb3d0ac Mon Sep 17 00:00:00 2001 From: Rafael David Tinoco Date: Mon, 16 May 2022 18:06:49 -0300 Subject: [PATCH] distro-tester: external runners --- .github/workflows/pr.yaml | 27 ++++++++++--------- .github/workflows/test-core-weekly.yaml | 13 ++++----- .github/workflows/test-noncore-weekly.yaml | 13 ++++----- tests/distro-tester/.gitignore | 4 --- tests/distro-tester/03-run-qemu.sh | 24 ++++++++++++----- .../distro-tester/files/docker-entrypoint.sh | 2 +- tests/distro-tester/images-copy/.gitignore | 1 + tests/distro-tester/images-full/.gitignore | 1 + tests/distro-tester/images/.gitignore | 1 + tests/distro-tester/kernels-copy/.gitignore | 1 + tests/distro-tester/kernels/.gitignore | 1 + 11 files changed, 53 insertions(+), 35 deletions(-) delete mode 100644 tests/distro-tester/.gitignore create mode 100644 tests/distro-tester/images-copy/.gitignore create mode 100644 tests/distro-tester/images-full/.gitignore create mode 100644 tests/distro-tester/images/.gitignore create mode 100644 tests/distro-tester/kernels-copy/.gitignore create mode 100644 tests/distro-tester/kernels/.gitignore diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index 9af0f57b4049..facf554c4c45 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -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: @@ -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: @@ -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 + diff --git a/.github/workflows/test-core-weekly.yaml b/.github/workflows/test-core-weekly.yaml index a9ef97b06f97..d3b402b9c92f 100644 --- a/.github/workflows/test-core-weekly.yaml +++ b/.github/workflows/test-core-weekly.yaml @@ -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: @@ -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 diff --git a/.github/workflows/test-noncore-weekly.yaml b/.github/workflows/test-noncore-weekly.yaml index 182287b82027..431850410d5d 100644 --- a/.github/workflows/test-noncore-weekly.yaml +++ b/.github/workflows/test-noncore-weekly.yaml @@ -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: @@ -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 diff --git a/tests/distro-tester/.gitignore b/tests/distro-tester/.gitignore deleted file mode 100644 index 46bced842dd1..000000000000 --- a/tests/distro-tester/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -images*/* -images-full*/* -kernels*/* -OLD*/* diff --git a/tests/distro-tester/03-run-qemu.sh b/tests/distro-tester/03-run-qemu.sh index d13a289242e4..30b4f4e70702 100755 --- a/tests/distro-tester/03-run-qemu.sh +++ b/tests/distro-tester/03-run-qemu.sh @@ -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 @@ -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" @@ -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 } @@ -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" @@ -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 \ diff --git a/tests/distro-tester/files/docker-entrypoint.sh b/tests/distro-tester/files/docker-entrypoint.sh index 059091c2bf42..ae9cd8ec7b74 100755 --- a/tests/distro-tester/files/docker-entrypoint.sh +++ b/tests/distro-tester/files/docker-entrypoint.sh @@ -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 diff --git a/tests/distro-tester/images-copy/.gitignore b/tests/distro-tester/images-copy/.gitignore new file mode 100644 index 000000000000..72e8ffc0db8a --- /dev/null +++ b/tests/distro-tester/images-copy/.gitignore @@ -0,0 +1 @@ +* diff --git a/tests/distro-tester/images-full/.gitignore b/tests/distro-tester/images-full/.gitignore new file mode 100644 index 000000000000..72e8ffc0db8a --- /dev/null +++ b/tests/distro-tester/images-full/.gitignore @@ -0,0 +1 @@ +* diff --git a/tests/distro-tester/images/.gitignore b/tests/distro-tester/images/.gitignore new file mode 100644 index 000000000000..72e8ffc0db8a --- /dev/null +++ b/tests/distro-tester/images/.gitignore @@ -0,0 +1 @@ +* diff --git a/tests/distro-tester/kernels-copy/.gitignore b/tests/distro-tester/kernels-copy/.gitignore new file mode 100644 index 000000000000..72e8ffc0db8a --- /dev/null +++ b/tests/distro-tester/kernels-copy/.gitignore @@ -0,0 +1 @@ +* diff --git a/tests/distro-tester/kernels/.gitignore b/tests/distro-tester/kernels/.gitignore new file mode 100644 index 000000000000..72e8ffc0db8a --- /dev/null +++ b/tests/distro-tester/kernels/.gitignore @@ -0,0 +1 @@ +*