Skip to content
Snippets Groups Projects
Commit e5ba486b authored by Daniel Salzman's avatar Daniel Salzman
Browse files

zscanner-test: improve absolute path handling

parent 8e9db17f
No related branches found
No related tags found
No related merge requests found
......@@ -51,6 +51,10 @@ AS_IF([test "x$YACC_BISON" != "xbison"],
[AC_MSG_ERROR([GNU bison needed for reentrant parsers, set the \$YACC variable before running configure])])
AC_PROG_INSTALL
# Full path to Knot source
abs_srcdir=`(cd $srcdir && pwd)`
AC_DEFINE_UNQUOTED([SOURCE_ABSOLUTE_DIR], ["$abs_srcdir"], [Knot source full path.])
# Check for Ragel
AC_PATH_PROG([RAGEL], [ragel], [echo !UNPROCESSED! ragel])
......
......@@ -17,8 +17,7 @@
#include "tests/zscanner/zscanner_tests.h"
#include <stdlib.h>
#include <unistd.h>
#include <libgen.h>
#include <config.h>
static int zscanner_tests_count(int argc, char *argv[]);
static int zscanner_tests_run(int argc, char *argv[]);
......@@ -36,22 +35,9 @@ static int zscanner_tests_count(int argc, char *argv[])
static int zscanner_tests_run(int argc, char *argv[])
{
/* It's very hard to get maximal buffer size! NetBSD requires it. */
char path[4096];
int ret;
// Set appropriate working directory.
if (realpath(argv[0], path) != NULL) {
ret = chdir(dirname(path));
}
// Run zscanner unittests via external tool.
if (access("./zscanner/test/run_tests.sh", F_OK) != -1) {
ret = system("./zscanner/test/run_tests.sh brief");
// If unittests is a script which points to .libs.
} else {
ret = system("../zscanner/test/run_tests.sh brief");
}
ret = system(SOURCE_ABSOLUTE_DIR "/src/zscanner/test/run_tests.sh test");
cmp_ok(ret, "==", 0, "zscanner unittests");
return 0;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment