Skip to content

Commit 3f87444

Browse files
authored
Merge pull request #1101 from lsm5/tmt-gpu
TMT: run tests with GPUs
2 parents cdc1edc + a53c427 commit 3f87444

File tree

8 files changed

+136
-10
lines changed

8 files changed

+136
-10
lines changed

.packit.yaml

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@ jobs:
2626
packages: [ramalama-fedora]
2727
enable_net: true
2828
targets: &fedora_copr_targets
29-
- fedora-development
30-
- fedora-latest-stable
29+
- fedora-all
3130
osh_diff_scan_after_copr_build: false
3231

3332
# Copr builds for CentOS Stream
@@ -52,12 +51,27 @@ jobs:
5251
trigger: pull_request
5352
packages: [ramalama-fedora]
5453
targets: *fedora_copr_targets
54+
tmt_plan: "/plans/rpm"
55+
identifier: "rpm-fedora"
56+
57+
- job: tests
58+
trigger: pull_request
59+
skip_build: true
60+
packages: [ramalama-fedora]
61+
targets:
62+
# FIXME: Validate test breaks on Fedora 41
63+
- fedora-development
64+
- fedora-latest-stable
65+
tmt_plan: "/plans/no-rpm"
66+
identifier: "no-rpm-fedora"
5567

5668
# Tests for CentOS Stream
5769
- job: tests
5870
trigger: pull_request
5971
packages: [ramalama-centos]
6072
targets: *centos_copr_targets
73+
tmt_plan: "/plans/rpm"
74+
identifier: "rpm-centos"
6175

6276
- job: propose_downstream
6377
trigger: release

container_build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ process_all_targets() {
206206

207207
# build ramalama container image first, as other images inherit from it
208208
build "ramalama" "$command"
209-
for i in container-images/*; do
209+
for i in ./container-images/*; do
210210
i=$(basename "$i")
211211
# skip these directories
212212
if [[ "$i" =~ ^(scripts|ramalama)$ ]]; then

plans/main.fmf

Lines changed: 0 additions & 6 deletions
This file was deleted.

plans/no-rpm.fmf

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
discover:
2+
how: fmf
3+
4+
execute:
5+
how: tmt
6+
7+
prepare:
8+
how: feature
9+
epel: enabled
10+
11+
provision:
12+
how: artemis
13+
hardware:
14+
gpu:
15+
device-name: GK210 (Tesla K80)
16+
vendor-name: NVIDIA
17+
disk:
18+
- size: ">= 512 GiB"
19+
memory: ">= 16 GB"
20+
21+
/gpu_info:
22+
summary: Display GPU info
23+
discover+:
24+
test: /test/tmt/no-rpm/gpu_info
25+
26+
/validate:
27+
discover+:
28+
test: /test/tmt/no-rpm/validate
29+
30+
/unit:
31+
discover+:
32+
test: /test/tmt/no-rpm/unit
33+
34+
/bats-nocontainer:
35+
discover+:
36+
test: /test/tmt/no-rpm/bats-nocontainer

plans/rpm.fmf

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
discover:
2+
how: shell
3+
tests:
4+
- name: /info
5+
test: rpm -qi python3-ramalama
6+
7+
execute:
8+
how: tmt

test/system/015-help.bats

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,11 @@ EOF
171171
@test "ramalama verify default store" {
172172
store=e_$(safename)
173173
run_ramalama --help
174-
is "$output" ".*default: ${HOME}/.local/share/ramalama" "Verify default store"
174+
if is_rootless; then
175+
is "$output" ".*default: ${HOME}/.local/share/ramalama" "Verify default store"
176+
else
177+
is "$output" ".*default: /var/lib/ramalama" "Verify default store"
178+
fi
175179

176180
conf=$RAMALAMA_TMPDIR/ramalama.conf
177181
cat >$conf <<EOF

test/tmt/bats-tests.sh

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/usr/bin/env bash
2+
3+
set -eo pipefail
4+
5+
# FIXME: enable bats-docker tests in TMT. Currently, they are not being run in
6+
# CI jobs, but can be triggered manually using this script.
7+
if [[ $# -eq 0 || $1 != "docker" && $1 != "nocontainer" ]]; then
8+
echo "Error: provide only one argument: 'docker' or 'nocontainer'"
9+
exit 1
10+
fi
11+
12+
set -x
13+
TMT_TREE=${TMT_TREE:-$(git rev-parse --show-toplevel)}
14+
pushd "$TMT_TREE"
15+
16+
if [[ $1 == "docker" ]]; then
17+
./container_build.sh build ramalama
18+
elif [[ $1 == "nocontainer" ]]; then
19+
./container-images/scripts/build_llama_and_whisper.sh
20+
fi
21+
./.github/scripts/install-ollama.sh
22+
23+
set +e
24+
tty
25+
set -e
26+
27+
make bats-"$1"
28+
popd

test/tmt/no-rpm.fmf

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
enabled: true
2+
adjust:
3+
# FIXME: these tests should ideally run on all envs including dist-git and
4+
# bodhi, but we can leave that for later.
5+
enabled: false
6+
when: initiator != packit
7+
8+
require:
9+
- bats
10+
- black
11+
- codespell
12+
- flake8
13+
- isort
14+
- jq
15+
- make
16+
- perl-Clone
17+
- perl-FindBin
18+
- pipx
19+
- podman-docker
20+
- pytest
21+
- python3-argcomplete
22+
- python3-huggingface-hub
23+
- shellcheck
24+
25+
/gpu_info:
26+
summary: Display GPU info
27+
test: lshw -C display
28+
require:
29+
- lshw
30+
31+
/validate:
32+
summary: Run validate test
33+
test: make -C $TMT_TREE validate
34+
35+
/unit:
36+
summary: Run unit tests
37+
test: make -C $TMT_TREE unit-tests
38+
39+
/bats-nocontainer:
40+
summary: Run system tests on host
41+
test: bash ./bats-tests.sh nocontainer
42+
duration: 30m

0 commit comments

Comments
 (0)