From 1120c8cf7c6041c523bcc917173b931560747b91 Mon Sep 17 00:00:00 2001 From: Panu Matilainen Date: Wed, 13 Sep 2023 15:51:32 +0300 Subject: [PATCH] Add a testcase for librpm development Should've been in 6ec0e4069e61fca3a5391c65effe72b2c782730d but at that time cmake in Fedora had a dependency on rpm making this hard or at least ugly. With that dependency fixed, we can now run cmake in there. --- tests/mktree.fedora | 1 + tests/rpmgeneral.at | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) diff --git a/tests/mktree.fedora b/tests/mktree.fedora index fefc962557..0bd24494d1 100755 --- a/tests/mktree.fedora +++ b/tests/mktree.fedora @@ -111,6 +111,7 @@ case $CMD in binutils \ bubblewrap \ bzip2 \ + cmake \ coreutils \ cpio \ curl \ diff --git a/tests/rpmgeneral.at b/tests/rpmgeneral.at index 35396c3938..0e0f426a95 100644 --- a/tests/rpmgeneral.at +++ b/tests/rpmgeneral.at @@ -58,6 +58,40 @@ RPMTEST_CHECK([runroot rpm --showrc],[0], [ignore]) RPMTEST_CLEANUP +AT_SETUP([rpm development]) +AT_KEYWORDS([devel]) + +cat << EOF > CMakeLists.txt +cmake_minimum_required(VERSION 3.18) +project(trpm VERSION 1.0 DESCRIPTION "test rpm API" LANGUAGES C) + +find_package(rpm REQUIRED) +add_executable(trpm trpm.c) +target_link_libraries(trpm PRIVATE rpm::librpm) +EOF + +cat << EOF > trpm.c +#include +#include + +int main(int argc, char *argv[]) +{ + int rc = rpmReadConfigFiles(NULL, NULL); + printf("%s: %d\n", RPMVERSION, rc); + rpmFreeRpmrc(); + return rc; +} +EOF + +cmake . && make + +RPMTEST_CHECK([[ +./trpm +]], +[0], +[AT_PACKAGE_VERSION: 0] +) +RPMTEST_CLEANUP # ------------------------------ # Check rpm --querytags