Skip to content

Commit

Permalink
Add simple import tests
Browse files Browse the repository at this point in the history
Signed-off-by: Cristian Le <[email protected]>
  • Loading branch information
LecrisUT authored and pboettch committed Nov 27, 2023
1 parent 1f0eb98 commit 3f6376d
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .distro/plans/import.fmf
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
summary:
Basic importing tests
prepare+:
- name: Include minimum fetching packages
how: install
package:
- git
discover+:
how: fmf
filter: "tag: import"
execute:
how: tmt
15 changes: 15 additions & 0 deletions .distro/tests/import/FetchContent/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# This is a simple project that tests using cmake to load the installed libraries
cmake_minimum_required(VERSION 3.14)

project(test_fetch_content LANGUAGES CXX)


FetchContent_Declare(nlohmann_json_schema_validator
GIT_REPOSITORY https://github.com/pboettch/json-schema-validator
GIT_TAG main
)
FetchContent_MakeAvailable(nlohmann_json_schema_validator)

if (NOT TARGET nlohmann_json_schema_validator::validator)
message(FATAL_ERROR "Missing target nlohmann_json_schema_validator::validator")
endif ()
11 changes: 11 additions & 0 deletions .distro/tests/import/find_package/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# This is a simple project that tests using cmake to load the installed libraries
cmake_minimum_required(VERSION 3.14)

project(test_find_package LANGUAGES CXX)

set(CMAKE_FIND_DEBUG_MODE ON)
find_package(nlohmann_json_schema_validator REQUIRED)

if (NOT TARGET nlohmann_json_schema_validator::validator)
message(FATAL_ERROR "Missing target nlohmann_json_schema_validator::validator")
endif ()
11 changes: 11 additions & 0 deletions .distro/tests/import/main.fmf
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Common test variables
tag:
- import
tier: 0
path: /tests/import

# Define tests
/find_package:
test: ./test_find_package.sh
/FetchContent:
test: ./test_FetchContent.sh
4 changes: 4 additions & 0 deletions .distro/tests/import/test_FetchContent.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash -eux

tmp_dir=$(mktemp -d)
cmake -S ./FetchContent -B ${tmp_dir}
4 changes: 4 additions & 0 deletions .distro/tests/import/test_find_package.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash -eux

tmp_dir=$(mktemp -d)
cmake -S ./find_package -B ${tmp_dir}

0 comments on commit 3f6376d

Please sign in to comment.