Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
5 changes: 5 additions & 0 deletions .github/testflinger-assets/env_setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash

# Set to default values. Will be set in snap_integration_tests.yml
export SNAP_TEST_SOURCE="${SNAP_TEST_SOURCE:-local}"
export SNAP_CHANNEL="${SNAP_CHANNEL:-${SNAP_TEST_SOURCE}}"
46 changes: 12 additions & 34 deletions .github/testflinger-assets/test_snap_device_script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,45 +16,23 @@ while sudo snap debug state /var/lib/snapd/state.json | grep -qE 'Doing|Undoing|
done
echo " --- Disabling auto-refresh for 24 hours"
sudo snap refresh --hold=24h
echo " --- Extracting snap package"
if [[ ! -f ./fpgad-snap-package.tar.gz ]]; then
echo "ERROR: Snap package tarball not found"
exit 1
fi
tar -xzvf fpgad-snap-package.tar.gz
echo " --- Listing extracted snap and component files"
echo "Snap files:"
find . -maxdepth 1 -name "*.snap" -type f
echo ""
echo "Component files:"
find . -maxdepth 1 -name "*.comp" -type f
echo ""
echo " --- Installing fpgad snap"
SNAP_FILE=$(find . -maxdepth 1 -name "*.snap" -type f | head -n 1)
if [[ -z "$SNAP_FILE" || ! -f "$SNAP_FILE" ]]; then
echo "ERROR: Snap file not found in tarball"
exit 1
fi
echo " --- Installing fpgad"
while sudo snap debug state /var/lib/snapd/state.json | grep -qE 'Doing|Undoing|Waiting'; do
echo " --- snapd internal tasks still running... waiting..."
sleep 10
done
sudo snap install "$SNAP_FILE" --dangerous
echo " --- Installing snap components"
COMP_FILES=$(find . -maxdepth 1 -name "*.comp" -type f)
if [[ -z "$COMP_FILES" ]]; then
echo "ERROR: No component files found in tarball - build may have failed"
exit 1

if [[ "${SNAP_TEST_SOURCE}" == "local" ]]; then
if [[ ! -f ./fpgad.snap ]]; then
echo "ERROR: SNAP_TEST_SOURCE=local but ./fpgad.snap is not present"
exit 1
fi
echo " --- SNAP_TEST_SOURCE=local, installing ./fpgad.snap --dangerous"
sudo snap install ./fpgad.snap --dangerous
else
echo " --- SNAP_TEST_SOURCE=${SNAP_TEST_SOURCE}, installing from store channel: ${SNAP_TEST_SOURCE}"
sudo snap install fpgad --channel="${SNAP_TEST_SOURCE}"
fi
for COMP_FILE in $COMP_FILES; do
echo " --- Installing component: $COMP_FILE"
while sudo snap debug state /var/lib/snapd/state.json | grep -qE 'Doing|Undoing|Waiting'; do
echo " --- snapd internal tasks still running... waiting..."
sleep 10
done
sudo snap install --dangerous "$COMP_FILE"
echo " --- Component installed successfully: $COMP_FILE"
done
echo " --- Installing provider snap(s)"
echo "INFO: Done preparing device"

Expand Down
4 changes: 3 additions & 1 deletion .github/testflinger-assets/testflinger_job.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ test_data:
local: ./fpgad.gz
- agent: device_script.sh
local: ./device_script.sh
- agent: env_setup.sh
local: ./env_setup.sh
test_cmds: |
set -e
# get hw-cert-team helper tools
Expand All @@ -51,7 +53,7 @@ test_data:

# Run the test script, but always retrieve artifacts even if it fails
set +e
_run '/home/ubuntu/device_script.sh'
_run 'source /home/ubuntu/env_setup.sh && /home/ubuntu/device_script.sh'
TEST_SCRIPT_EXIT=$?
set -e

Expand Down
219 changes: 0 additions & 219 deletions .github/workflows/integration_tests.yaml.yml

This file was deleted.

80 changes: 80 additions & 0 deletions .github/workflows/integration_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: Run integration tests on a DUT via testflinger
on:
workflow_dispatch:
pull_request:
Comment thread
Sinan-Karakaya marked this conversation as resolved.
jobs:
binary-integration-tests:
name: Build and Test the Daemon Binary on DUT
runs-on: [self-hosted, self-hosted-linux-amd64-jammy-private-endpoint-medium]
# todo: enable testflinger environment
# environment:
# name: testflinger
# if: ${{ vars.TESTFLINGER_TESTS_ENABLED == '1' && ! github.event.pull_request.draft}}
if: ${{ !github.event.pull_request.draft }}
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Install dependencies
shell: bash
run: |
echo "::group::install dependencies"
sudo snap install yq
echo "::endgroup::"
- name: Prepare Testflinger Job
id: prepare-tf-job
shell: bash
run: |
echo "::group::creating fpgad.gz tarball"
tar -czvf ../fpgad.gz --exclude="target" --exclude=".git" -C ../ ./fpgad
mv ../fpgad.gz ./fpgad.gz
echo "::endgroup::"

echo "::group::creating job.yaml"
yq '.test_data.attachments = [
{"agent": "device_script.sh", "local": "'"$(pwd)"'/.github/testflinger-assets/test_binary_device_script.sh"},
{"agent": "fpgad.gz", "local": "'"$(pwd)"'/fpgad.gz"},
{"agent": "env_setup.sh", "local": "'"$(pwd)"'/.github/testflinger-assets/env_setup.sh"}
]' .github/testflinger-assets/testflinger_job.yaml | tee job.yaml
echo "::endgroup::"

echo "test_path=job.yaml" >> $GITHUB_OUTPUT
- name: Submit TF job
id: submit
uses: canonical/testflinger/.github/actions/submit@rev263
continue-on-error: true
with:
poll: true
job-path: ${{ steps.prepare-tf-job.outputs.test_path }}
- name: Fetch and Display Artifacts
shell: bash
run: |
echo "::group::retrieve llvm-cov artifacts"
testflinger artifacts ${{steps.submit.outputs.id }}
tar -xvzf artifacts.tgz
echo "::endgroup::"

for f in artifacts/* ; do
echo "::group::$f"
cat "$f"
echo "::endgroup::"
done
- name: Upload artifacts
uses: actions/upload-artifact@v7
with:
name: llvm-cov-artifacts
path: artifacts/*
- name: Report test status
shell: bash
run: |
if [ "${{ steps.submit.outcome }}" != "success" ]; then
echo "::error::test job didn't complete successfully"
exit 1
fi
if [[ ! -f artifacts/coverage_test.log ]]; then
echo "::error::coverage_test.log not found, did the tests fail to start?"
exit 1
fi
if grep -q "test result: FAILED" artifacts/coverage_test.log; then
echo "::error::found failure phrase in coverage_test.log"
exit 1
fi
Loading
Loading