diff options
author | Stephen Gallagher <sgallagh@redhat.com> | 2012-05-11 09:31:24 -0400 |
---|---|---|
committer | Jan Zeleny <jzeleny@redhat.com> | 2012-05-15 09:08:24 +0200 |
commit | 013e9da407a3b583db93f827f054cd2fd6127739 (patch) | |
tree | 389e1a44fc70b3e0a52c72a54c45bcd5986338f3 /ini/ini_parse_ut.c | |
parent | 6b3bc0158926ed03536c6c72b3847b8c04ace864 (diff) | |
download | ding-libs-013e9da407a3b583db93f827f054cd2fd6127739.tar.gz ding-libs-013e9da407a3b583db93f827f054cd2fd6127739.tar.xz ding-libs-013e9da407a3b583db93f827f054cd2fd6127739.zip |
Fix issue when running make distcheck
When running 'make distcheck', all files in the $srcdir are set to
read-only, to ensure that the build does not modify the source.
However, this broke our ability to test file permissions. We will
now copy the file to the builddir and do the tests there, where
we have control.
Diffstat (limited to 'ini/ini_parse_ut.c')
-rw-r--r-- | ini/ini_parse_ut.c | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/ini/ini_parse_ut.c b/ini/ini_parse_ut.c index 75a1145..6cab9d4 100644 --- a/ini/ini_parse_ut.c +++ b/ini/ini_parse_ut.c @@ -42,6 +42,8 @@ char *confdir = NULL; if (verbose) foo; \ } while(0) +#define FOO_CONF "./ini/ini.d/foo.conf" + typedef int (*test_fn)(void); int test_one_file(const char *in_filename, @@ -327,10 +329,8 @@ int merge_values_test(void) const char *resname = "./merge.conf.out"; const char *checkname = "./expect.conf.out"; char command[PATH_MAX * 3]; - char *srcdir; - srcdir = getenv("srcdir"); - sprintf(filename, "%s/ini/ini.d/foo.conf", (srcdir == NULL) ? "." : srcdir); + memcpy(filename, FOO_CONF, sizeof(FOO_CONF)); error = simplebuffer_alloc(&sbobj); if (error) { @@ -639,11 +639,8 @@ int startup_test(void) struct ini_cfgobj *ini_config = NULL; char **error_list = NULL; char filename[PATH_MAX]; - char *srcdir; - srcdir = getenv("srcdir"); - sprintf(filename, "%s/ini/ini.d/foo.conf", - (srcdir == NULL) ? "." : srcdir); + memcpy(filename, FOO_CONF, sizeof(FOO_CONF)); INIOUT(printf("<==== Startup test ====>\n")); @@ -746,15 +743,12 @@ int reload_test(void) char infile[PATH_MAX]; char outfile[PATH_MAX]; const char *command = "cp"; - char *srcdir; char *builddir; int changed = 0; INIOUT(printf("<==== Reload test ====>\n")); - srcdir = getenv("srcdir"); - sprintf(infile, "%s/ini/ini.d/foo.conf", - (srcdir == NULL) ? "." : srcdir); + memcpy(infile, FOO_CONF, sizeof(FOO_CONF)); builddir = getenv("builddir"); sprintf(outfile, "%s/foo.conf", (builddir == NULL) ? "." : builddir); |