Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: adjust workflow and case for recent change #109

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion .github/workflows/vmsdk-test-python.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,37 @@ on:
paths:
- 'vmsdk/**/*.py'
- 'common/**/*.py'
- 'setupenv.sh'
- '.github/workflows/vmsdk-test-python.yaml'
pull_request:
paths:
- 'vmsdk/**/*.py'
- 'common/**/*.py'
- 'setupenv.sh'
- '.github/workflows/vmsdk-test-python.yaml'
workflow_dispatch:

env:
VMSDK_PYTEST_DIR: 'vmsdk_pytest'

jobs:
vmsdk_pytest:
runs-on: [self-hosted, tdx-guest]
defaults:
run:
working-directory: ${{env.VMSDK_PYTEST_DIR}}
steps:
- uses: actions/checkout@v3
- name: Clean up intermediate files
continue-on-error: true
run: |
# Remove the intermediate files that could be left
# by previous run with sudo. Otherwise, the checkout
# will fail with permission issue.
sudo rm -fr ./*
- name: Checkout repo
uses: actions/checkout@v4
with:
path: ${{env.VMSDK_PYTEST_DIR}}
- name: Run PyTest for VMSDK
run: |
set -ex
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,23 @@ on:
- main
paths:
- 'vmsdk/rust/**/*'
- '.github/workflows/vmsdk-test-rust.yaml'
pull_request:
paths:
- 'vmsdk/rust/**/*'
- '.github/workflows/vmsdk-test-rust.yaml'
workflow_dispatch:

env:
CARGO_TERM_COLOR: always
VMSDK_RUST_TEST_DIR: vmsdk_rust_test

jobs:
vmsdk_rust_test:
runs-on: [self-hosted, tdx-guest]
defaults:
run:
working-directory: ${{env.VMSDK_RUST_TEST_DIR}}
steps:
- name: Clean up intermediate files
continue-on-error: true
Expand All @@ -26,7 +32,10 @@ jobs:
# will fail with permission issue.
sudo rm -f vmsdk/rust/cctrusted_vm/Cargo.lock
sudo rm -fr vmsdk/rust/cctrusted_vm/target
- uses: actions/checkout@v3
- name: Checkout repo
uses: actions/checkout@v4
with:
path: ${{env.VMSDK_RUST_TEST_DIR}}
- name: Run tests
run: |
cd vmsdk/rust/cctrusted_vm/
Expand Down
2 changes: 1 addition & 1 deletion vmsdk/python/cctrusted_vm/sdk.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def get_cc_eventlog(self, start:int = None, count:int = None) -> list:
self._cvm.process_eventlog()

event_logs = EventLogs(self._cvm.boot_time_event_log, self._cvm.runtime_event_log,
TcgEventLog.TCG_PCCLIENT_FORMAT)
TcgEventLog.TCG_FORMAT_PCCLIENT)

event_logs.select(start, count)

Expand Down
3 changes: 2 additions & 1 deletion vmsdk/python/tests/test_sdk.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from cctrusted_base.ccreport import CcReport, CcReportData, CcReportSignature
from cctrusted_base.tcg import TcgImrEvent, TcgPcClientImrEvent
from cctrusted_base.tcgcel import TcgTpmsCelEvent
import pytest

def test_get_default_algorithms(vm_sdk, default_alg_id):
Expand Down Expand Up @@ -81,7 +82,7 @@ def test_get_cc_eventlog_with_valid_input(vm_sdk):
event_count = 0
for e in eventlog:
event_count += 1
assert isinstance(e, (TcgImrEvent, TcgPcClientImrEvent))
assert isinstance(e, (TcgImrEvent, TcgPcClientImrEvent, TcgTpmsCelEvent))

def test_get_cc_report_with_valid_input(vm_sdk, check_quote_valid_input):
"""Test get_cc_report() function with valid input."""
Expand Down
Loading