Skip to content

Commit

Permalink
Add a testcase for librpm development
Browse files Browse the repository at this point in the history
Should've been in 6ec0e40 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.
  • Loading branch information
pmatilai committed Sep 13, 2023
1 parent 959b4e4 commit 1120c8c
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
1 change: 1 addition & 0 deletions tests/mktree.fedora
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ case $CMD in
binutils \
bubblewrap \
bzip2 \
cmake \
coreutils \
cpio \
curl \
Expand Down
34 changes: 34 additions & 0 deletions tests/rpmgeneral.at
Original file line number Diff line number Diff line change
Expand Up @@ -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 <stdio.h>
#include <rpm/rpmlib.h>

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
Expand Down

0 comments on commit 1120c8c

Please sign in to comment.