Skip to content

Commit

Permalink
Test script refactor
Browse files Browse the repository at this point in the history
Signed-off-by: Wei Liu <[email protected]>
  • Loading branch information
liuw1 authored and gaojiaqi7 committed Nov 29, 2023
1 parent 0d63565 commit 4328283
Show file tree
Hide file tree
Showing 12 changed files with 1,117 additions and 709 deletions.
157 changes: 32 additions & 125 deletions .github/workflows/integration-tdx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,162 +33,69 @@ jobs:

# - name: Install tools for sgx lib
# run: sudo dnf group install 'Development Tools' | sudo dnf --enablerepo=powertools install ocaml ocaml-ocamlbuild wget rpm-build pkgcon
- name: Clean test repository
run: |
sudo rm -rf sh_script/test/
- name: Checkout sources
uses: actions/checkout@v4
with:
submodules: recursive

- name: Preparation Work
run: bash sh_script/preparation.sh

- name: Build Migration TD binary
run: bash sh_script/build_final.sh -t migtd -c -a on

- name: Run Tests - Test Migration TD
run: |
sudo bash sh_script/integration_tdx.sh -d target/release/migtd.bin -s target/release/migtd.bin
run: cargo image

- name: Run Tests - Cycle Test Migration TD (20)
- name: Run Tests - Test Migration TD 20 Cycles
run: |
sudo bash sh_script/integration_tdx.sh -d target/release/migtd.bin -s target/release/migtd.bin -n 20
pushd sh_script/test
sudo pytest -k "cycle"
popd
- name: Build all test binaries
run: bash sh_script/build_final.sh -t test -c -a on

- name: Run Tests - Run test TD payload
run: |
sudo bash sh_script/integration_tdx.sh -f Bin/final-test.bin
- name: Run Tests - Run migration test case 001
run: |
sudo bash sh_script/integration_tdx.sh -d Bin/migtd_001.bin -s Bin/migtd_001.bin
- name: Run Tests - Run migration test case 002
run: |
sudo bash sh_script/integration_tdx.sh -d Bin/migtd_002.bin -s Bin/migtd_001.bin
- name: Run Tests - Run migration test case 003
run: |
sudo bash sh_script/integration_tdx.sh -d Bin/migtd_003.bin -s Bin/migtd_001.bin
- name: Run Tests - Run migration test case 004
run: |
sudo bash sh_script/integration_tdx.sh -d Bin/migtd_004.bin -s Bin/migtd_004.bin
- name: Run Tests - Run migration test case 005
run: |
sudo bash sh_script/integration_tdx.sh -d Bin/migtd_005.bin -s Bin/migtd_005.bin
- name: Run Tests - Run migration test case 006
run: |
sudo bash sh_script/integration_tdx.sh -d Bin/migtd_006.bin -s Bin/migtd_006.bin
- name: Run Tests - Run migration test case 007
run: |
sudo bash sh_script/integration_tdx.sh -d Bin/migtd_007.bin -s Bin/migtd_no.bin
- name: Run Tests - Run migration test case 008
run: |
sudo bash sh_script/integration_tdx.sh -d Bin/migtd_008.bin -s Bin/migtd_no.bin
- name: Run Tests - Run migration test case 009
run: |
sudo bash sh_script/integration_tdx.sh -d Bin/migtd_009.bin -s Bin/migtd_009.bin
- name: Run Tests - Run migration test case 010
run: |
sudo bash sh_script/integration_tdx.sh -d Bin/migtd_010.bin -s Bin/migtd_010.bin
- name: Run Tests - Run migration test case 011
run: |
sudo bash sh_script/integration_tdx.sh -d Bin/migtd_011.bin -s Bin/migtd_011.bin
- name: Run Tests - Run migration test case 012
run: |
sudo bash sh_script/integration_tdx.sh -d Bin/migtd_dst_012.bin -s Bin/migtd_src_012.bin
- name: Run Tests - Run migration test case 013
run: |
sudo bash sh_script/integration_tdx.sh -d Bin/migtd_dst_013.bin -s Bin/migtd_src_013.bin

- name: Run Tests - Run migration test case 014
- name: Run Tests
run: |
sudo bash sh_script/integration_tdx.sh -d Bin/migtd_dst_014.bin -s Bin/migtd_src_014.bin
pushd sh_script/test
sudo pytest -k "not cycle"
popd
virtio_serial:
name: Run TDX Integration Test (virtio-serial)
runs-on: [self-hosted, tdx]

steps:
- name: Clean test repository
run: |
sudo rm -rf sh_script/test/
- name: Checkout sources
uses: actions/checkout@v4
with:
submodules: recursive

- name: Preparation Work
run: bash sh_script/preparation.sh

- name: Build Migration TD binary
run: bash sh_script/build_final.sh -t migtd -d serial -c -a on

- name: Run Tests - Test Migration TD
run: |
sudo bash sh_script/integration_tdx.sh -d target/release/migtd.bin -s target/release/migtd.bin -t serial
run: cargo image --no-default-features --features remote-attestation,stack-guard,virtio-serial

- name: Run Tests - Cycle Test Migration TD (20)
- name: Run Tests - Test Migration TD 20 Cycles
run: |
sudo bash sh_script/integration_tdx.sh -d target/release/migtd.bin -s target/release/migtd.bin -t serial -n 20
pushd sh_script/test
sudo pytest -k "cycle" --device_type serial
popd
- name: Build all test binaries
run: bash sh_script/build_final.sh -t test -c -a on -d serial

- name: Run Tests - Run migration test case 001
run: |
sudo bash sh_script/integration_tdx.sh -d Bin/migtd_001.bin -s Bin/migtd_001.bin -t serial
- name: Run Tests - Run migration test case 002
run: |
sudo bash sh_script/integration_tdx.sh -d Bin/migtd_002.bin -s Bin/migtd_001.bin -t serial
- name: Run Tests - Run migration test case 003
run: |
sudo bash sh_script/integration_tdx.sh -d Bin/migtd_003.bin -s Bin/migtd_001.bin -t serial
- name: Run Tests - Run migration test case 004
run: |
sudo bash sh_script/integration_tdx.sh -d Bin/migtd_004.bin -s Bin/migtd_004.bin -t serial
- name: Run Tests - Run migration test case 005
run: |
sudo bash sh_script/integration_tdx.sh -d Bin/migtd_005.bin -s Bin/migtd_005.bin -t serial
- name: Run Tests - Run migration test case 006
run: |
sudo bash sh_script/integration_tdx.sh -d Bin/migtd_006.bin -s Bin/migtd_006.bin -t serial
- name: Run Tests - Run migration test case 007
run: |
sudo bash sh_script/integration_tdx.sh -d Bin/migtd_007.bin -s Bin/migtd_no.bin -t serial
- name: Run Tests - Run migration test case 008
run: |
sudo bash sh_script/integration_tdx.sh -d Bin/migtd_008.bin -s Bin/migtd_no.bin -t serial
- name: Run Tests - Run migration test case 009
run: |
sudo bash sh_script/integration_tdx.sh -d Bin/migtd_009.bin -s Bin/migtd_009.bin -t serial
- name: Run Tests - Run migration test case 010
- name: Run Tests
run: |
sudo bash sh_script/integration_tdx.sh -d Bin/migtd_010.bin -s Bin/migtd_010.bin -t serial
pushd sh_script/test
sudo pytest -k "not cycle" --device_type serial
popd
- name: Run Tests - Run migration test case 011
run: |
sudo bash sh_script/integration_tdx.sh -d Bin/migtd_011.bin -s Bin/migtd_011.bin -t serial
- name: Run Tests - Run migration test case 012
run: |
sudo bash sh_script/integration_tdx.sh -d Bin/migtd_dst_012.bin -s Bin/migtd_src_012.bin -t serial
- name: Run Tests - Run migration test case 013
run: |
sudo bash sh_script/integration_tdx.sh -d Bin/migtd_dst_013.bin -s Bin/migtd_src_013.bin -t serial
- name: Run Tests - Run migration test case 014
run: |
sudo bash sh_script/integration_tdx.sh -d Bin/migtd_dst_014.bin -s Bin/migtd_src_014.bin -t serial

71 changes: 71 additions & 0 deletions doc/integration_test.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# Migration TD Integration Test
## Preparation
Download source code & test script:
```
git clone https://github.com/intel/MigTD.git
git submodule update --init --recursive
./sh_script/preparation.sh
```
## Setup pytest environment
Please use recommend configuration in [integration_test.py](../sh_script/test/integration_test.py).

## Config test configuration file
```
cd sh_script/test
```
Config [test configration file](../sh_script/test/conf/pyproject.toml), for example:
```
[migtd.config]
qemu="/usr/local/bin/qemu-system-x86_64"
mig_td_script = "mig-td.sh"
user_td_script = "user-td.sh"
connect_script = "connect.sh"
pre_mig_script = "pre-mig.sh"
user_td_bios_img = "/home/env/OVMF.fd"
kernel_img = "/home/env/bzImage"
guest_img = "/home/env/guest.img"
stress_test_cycles = 1
```
## Build & Test
### Build Migration TD binary - Vsock
```
cargo image
```
### Run Test
Set stress_test_cycles to 1 in configration file.
```
pushd sh_script/test
sudo pytest -k "cycle"
popd
```
### Build Migration TD Test binaries - Vsock
```
bash sh_script/build_final.sh -t test -c -a on
```
### Run Test
```
pushd sh_script/test
sudo pytest -k "not cycle"
popd
```
### Build Migration TD binary - Serial
```
cargo image --no-default-features --features remote-attestation,stack-guard,virtio-serial
```
### Run Test
Set stress_test_cycles to 1 in configration file.
```
pushd sh_script/test
sudo pytest -k "cycle" --device_type serial
popd
```
### Build Migration TD Test binaries - Serial
```
bash sh_script/build_final.sh -t test -c -a on -d serial
```
### Run Test
```
pushd sh_script/test
sudo pytest -k "not cycle" --device_type serial
popd
```
Loading

0 comments on commit 4328283

Please sign in to comment.