From 8329b0255702762ee87a6eab81be855e2289075f Mon Sep 17 00:00:00 2001 From: Honza Horak Date: Fri, 15 Jan 2021 11:49:55 +0100 Subject: [PATCH] Add runstatedir test Related: RHBZ#1831941 --- tests/functional.fmf | 5 +++++ tests/runstatedir/Makefile.am | 4 ++++ tests/runstatedir/configure.ac | 28 ++++++++++++++++++++++++++++ tests/runstatedir/hello.c.in | 8 ++++++++ tests/runstatedir/main.fmf | 13 +++++++++++++ tests/runstatedir/run | 16 ++++++++++++++++ 6 files changed, 74 insertions(+) create mode 100644 tests/functional.fmf create mode 100644 tests/runstatedir/Makefile.am create mode 100644 tests/runstatedir/configure.ac create mode 100644 tests/runstatedir/hello.c.in create mode 100644 tests/runstatedir/main.fmf create mode 100755 tests/runstatedir/run diff --git a/tests/functional.fmf b/tests/functional.fmf new file mode 100644 index 0000000..4ad7362 --- /dev/null +++ b/tests/functional.fmf @@ -0,0 +1,5 @@ +summary: Functional tier tests +discover: + how: fmf +execute: + how: tmt diff --git a/tests/runstatedir/Makefile.am b/tests/runstatedir/Makefile.am new file mode 100644 index 0000000..a1da5a8 --- /dev/null +++ b/tests/runstatedir/Makefile.am @@ -0,0 +1,4 @@ +# Taken from http://www.idryman.org/blog/2016/03/10/autoconf-tutorial-1/ +bin_PROGRAMS = hello +hello_SOURCES = hello.c + diff --git a/tests/runstatedir/configure.ac b/tests/runstatedir/configure.ac new file mode 100644 index 0000000..72aff9a --- /dev/null +++ b/tests/runstatedir/configure.ac @@ -0,0 +1,28 @@ +# Taken from http://www.idryman.org/blog/2016/03/10/autoconf-tutorial-1/ +# Must init the autoconf setup +# The first parameter is project name +# second is version number +# third is bug report address +AC_INIT([hello], [1.0]) + +# We want to expand templates in this file +AC_CONFIG_FILES([hello.c]) +# Store the auxiliary build tools (e.g., install-sh, config.sub, config.guess) +# in this dir (build-aux) +AC_CONFIG_AUX_DIR([build-aux]) + +# Init automake, and specify this program use relaxed structures. +# i.e. this program doesn't follow the gnu coding standards, and doesn't have +# ChangeLog, COPYING, AUTHORS, INSTALL, README etc. files. +AM_INIT_AUTOMAKE([-Wall -Werror foreign]) + +# Check for C compiler +AC_PROG_CC +# We can add more checks in this section + +# Tells automake to create a Makefile +# See https://www.gnu.org/software/automake/manual/html_node/Requirements.html +AC_CONFIG_FILES([Makefile]) + +# Generate the output +AC_OUTPUT diff --git a/tests/runstatedir/hello.c.in b/tests/runstatedir/hello.c.in new file mode 100644 index 0000000..b8bae8f --- /dev/null +++ b/tests/runstatedir/hello.c.in @@ -0,0 +1,8 @@ +// Taken from http://www.idryman.org/blog/2016/03/10/autoconf-tutorial-1/ +#include +int main(int argc, char** argv) { + printf("hello world!\n"); + printf("runstatedir: @runstatedir@\n"); + return 0; +} + diff --git a/tests/runstatedir/main.fmf b/tests/runstatedir/main.fmf new file mode 100644 index 0000000..954e3cf --- /dev/null +++ b/tests/runstatedir/main.fmf @@ -0,0 +1,13 @@ +summary: The test for runstatedir feature +description: | + This test verifies basic functionality including the --runstatedir + feature: https://lists.gnu.org/archive/html/autoconf-patches/2013-09/msg00018.html +contact: Honza Horak +component: +test: ./run +path: /tests/runstatedir +recommend: +- autoconf +- automake +- libtool +duration: 5m diff --git a/tests/runstatedir/run b/tests/runstatedir/run new file mode 100755 index 0000000..0552af8 --- /dev/null +++ b/tests/runstatedir/run @@ -0,0 +1,16 @@ +#!/bin/bash + +# Taken from http://www.idryman.org/blog/2016/03/10/autoconf-tutorial-1/ + +set -xe + +autoreconf --verbose --install --force +./configure --help +./configure --runstatedir=/var/mytmp +make +./hello +./hello | grep 'hello world!' +./hello | grep 'runstatedir: /var/mytmp' +make dist + +echo "Test for --runstatedir succeeded."