Skip to content

Commit

Permalink
Add pure CMake tests
Browse files Browse the repository at this point in the history
Signed-off-by: Cristian Le <[email protected]>
  • Loading branch information
LecrisUT committed Oct 2, 2024
1 parent 0ff05e6 commit 3f5d367
Show file tree
Hide file tree
Showing 9 changed files with 69 additions and 11 deletions.
11 changes: 11 additions & 0 deletions .distro/plans/cmake.fmf
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
summary: Test CMake only modules
discover+:
how: fmf
filter: "tag: cmake"
prepare:
- name: Install additional test packages
how: install
package:
- gfortran
execute:
how: tmt
4 changes: 4 additions & 0 deletions .distro/plans/main.fmf
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
discover:
how: fmf
path: .

adjust+:
# Cannot use initiator: fedora-ci reliably yet
when: initiator is not defined or initiator != packit
Expand Down
6 changes: 2 additions & 4 deletions .distro/plans/smoke.fmf
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
summary:
Basic smoke tests
discover:
how: fmf
summary: Basic smoke tests
discover+:
filter: "tag: smoke"
execute:
how: tmt
7 changes: 0 additions & 7 deletions .distro/tests/smoke.fmf
Original file line number Diff line number Diff line change
@@ -1,7 +0,0 @@
tag: [ smoke ]
tier: 0
path: /

/version:
test: |
python3 -c "import f2py_cmake; print(f2py_cmake.__version__)"
1 change: 1 addition & 0 deletions .fmf/version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1
4 changes: 4 additions & 0 deletions tests/main.fmf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
path: /
test: ./tests/test_pure_cmake.sh
framework: beakerlib
tag: [ cmake ]
1 change: 1 addition & 0 deletions tests/packages/f77/main.fmf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
summary: Minimal f77 example
23 changes: 23 additions & 0 deletions tests/smoke.fmf
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/:
inherit: false

tag: [ smoke ]
tier: 0
path: /

/python-version:
test: |
python3 -c "import f2py_cmake; print(f2py_cmake.__version__)"

/cmake-modules:
test: |
cat <<-EOF > test_modules.cmake
find_package(Python REQUIRED COMPONENTS NumPy)
include(UseF2Py RESULT_VARIABLE UseF2Py_PATH)
message("UseF2Py_PATH=\${UseF2Py_PATH}")
EOF
cmake -P test_modules.cmake
adjust:
enabled: false
because: |
Cannot test inside script-mode because targets are not propagated
23 changes: 23 additions & 0 deletions tests/test_pure_cmake.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# shellcheck disable=all
. /usr/share/beakerlib/beakerlib.sh || exit 1

rlJournalStart
rlPhaseStartSetup
rlRun "tmp=\$(mktemp -d)" 0 "Create tmp directory"
rlRun "root=\$(pwd)" 0 "Save the tmt root path"
rlRun "pushd $tmp"
rlRun "set -o pipefail"
rlPhaseEnd

rlPhaseStartTest
rlRun "cmake -S $root$TMT_TEST_NAME -B ./build" 0 "Configure project"
rlRun "cmake --build ./build" 0 "Build project"
rlPhaseEnd

rlPhaseStartCleanup
rlRun "popd"
rlRun "rm -r $tmp" 0 "Remove tmp directory"
rlPhaseEnd
rlJournalEnd

0 comments on commit 3f5d367

Please sign in to comment.