On 04/15/2014 09:42 PM, Lukas Slebodnik wrote:
On (15/04/14 20:00), Nikolai Kondrashov wrote:
>From 76b7d1ff6b1a4117a5e8917b29d8b2b916d1e439 Mon Sep 17 00:00:00 2001
> From: Nikolai Kondrashov <Nikolai.Kondrashov(a)redhat.com>
> Date: Tue, 15 Apr 2014 19:08:34 +0300
> Subject: [PATCH 1/1] tests: Don't assume absolute test dir in test_io.c
>
> Do not assume TEST_DIR path is absolute in test_io.c, assume it is
> the current directory.
>
> This fixes test-io execution with relative test dir path configured
> with --with-test-dir.
> ---
> src/tests/cmocka/test_io.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/src/tests/cmocka/test_io.c b/src/tests/cmocka/test_io.c
> index 266f2ce..453e8f7 100644
> --- a/src/tests/cmocka/test_io.c
> +++ b/src/tests/cmocka/test_io.c
> @@ -40,7 +40,7 @@
> #include "util/util.h"
> #include "tests/common.h"
>
> -#define FILE_PATH TEST_DIR"/test_io.XXXXXX"
> +#define FILE_PATH "test_io.XXXXXX"
> #define NON_EX_PATH "non-existent-path"
>
> /* Creates a unique temporary file inside TEST_DIR and returns its path*/
> @@ -63,7 +63,7 @@ static char *get_filepath(char path[])
>
> void setup_dirp(void **state)
> {
> - DIR *dirp = opendir(TEST_DIR);
> + DIR *dirp = opendir(".");
> if (dirp == NULL) {
> int err = errno;
> fprintf(stderr, "Could not open directory:'%s' [%s]\n",
> --
> 1.9.1
>
This patch is useless.
Wrong.
The default value of TESTDIR is "."
Correct.
It would be nice to at least test and provide more substantial evidence,
before embarrassing a developer and making him spend time defending his
patch.
The default will always work as there is always a current directory. The path
used in contrib/fedora/bashrc_sssd (/dev/shm), which some are probably using,
works as well.
However, before running the actual tests, test_io.c invokes "tests_set_cwd",
which chdir's to TEST_DIR. This breaks running with relative paths, as the
tests try to access TEST_DIR below TEST_DIR.
Sincerely,
Nick