added ./configure --with-psl-testfile to set PSL test file path
This commit is contained in:
parent
c93268ce25
commit
c481e8019d
|
@ -97,6 +97,14 @@ AC_ARG_WITH(psl-file,
|
||||||
PSL_FILE="\$(top_srcdir)/data/effective_tld_names.dat")
|
PSL_FILE="\$(top_srcdir)/data/effective_tld_names.dat")
|
||||||
AC_SUBST(PSL_FILE)
|
AC_SUBST(PSL_FILE)
|
||||||
|
|
||||||
|
# Check for custom PSL test file
|
||||||
|
AC_ARG_WITH(psl-testfile,
|
||||||
|
AC_HELP_STRING([--with-psl-testfile=[PATH]],
|
||||||
|
[path to PSL test file]),
|
||||||
|
PSL_TESTFILE=$withval,
|
||||||
|
PSL_TESTFILE="\$(top_srcdir)/data/test_psl.txt")
|
||||||
|
AC_SUBST(PSL_TESTFILE)
|
||||||
|
|
||||||
# Override the template file name of the generated .pc file, so that there
|
# Override the template file name of the generated .pc file, so that there
|
||||||
# is no need to rename the template file when the API version changes.
|
# is no need to rename the template file when the API version changes.
|
||||||
AC_CONFIG_FILES([Makefile
|
AC_CONFIG_FILES([Makefile
|
||||||
|
@ -120,5 +128,6 @@ AC_MSG_NOTICE([Summary of build options:
|
||||||
LDFlags: ${LDFLAGS}
|
LDFlags: ${LDFLAGS}
|
||||||
Builtin PSL: ${enable_builtin}
|
Builtin PSL: ${enable_builtin}
|
||||||
PSL File: ${PSL_FILE}
|
PSL File: ${PSL_FILE}
|
||||||
|
PSL Test File: ${PSL_TESTFILE}
|
||||||
Tests: ${TESTS_INFO}
|
Tests: ${TESTS_INFO}
|
||||||
])
|
])
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
DEFS = @DEFS@ -DDATADIR=\"$(top_srcdir)/data\" -DSRCDIR=\"$(srcdir)\" -DPSL_FILE=\"$(PSL_FILE)\"
|
DEFS = @DEFS@ -DDATADIR=\"$(top_srcdir)/data\" -DSRCDIR=\"$(srcdir)\" -DPSL_FILE=\"$(PSL_FILE)\" -DPSL_TESTFILE=\"$(PSL_TESTFILE)\"
|
||||||
AM_CPPFLAGS = -I$(top_srcdir)/include
|
AM_CPPFLAGS = -I$(top_srcdir)/include
|
||||||
LDADD = ../src/libpsl-@LIBPSL_API_VERSION@.la
|
LDADD = ../src/libpsl-@LIBPSL_API_VERSION@.la
|
||||||
|
|
||||||
|
|
|
@ -39,8 +39,6 @@
|
||||||
|
|
||||||
#include <libpsl.h>
|
#include <libpsl.h>
|
||||||
|
|
||||||
#define TESTDATA DATADIR"/test_psl.txt"
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
ok,
|
ok,
|
||||||
failed;
|
failed;
|
||||||
|
@ -110,7 +108,7 @@ static void test_psl(void)
|
||||||
// Norwegian with lowercase oe
|
// Norwegian with lowercase oe
|
||||||
test(psl, "www.\303\270yer.no", "www.\303\270yer.no");
|
test(psl, "www.\303\270yer.no", "www.\303\270yer.no");
|
||||||
|
|
||||||
if ((fp = fopen(TESTDATA, "r"))) {
|
if ((fp = fopen(PSL_TESTFILE, "r"))) {
|
||||||
while ((fgets(buf, sizeof(buf), fp))) {
|
while ((fgets(buf, sizeof(buf), fp))) {
|
||||||
if (sscanf(buf, " checkPublicSuffix('%127[^']' , '%127[^']", domain, expected_regdom) != 2) {
|
if (sscanf(buf, " checkPublicSuffix('%127[^']' , '%127[^']", domain, expected_regdom) != 2) {
|
||||||
if (sscanf(buf, " checkPublicSuffix('%127[^']' , %127[nul]", domain, expected_regdom) != 2)
|
if (sscanf(buf, " checkPublicSuffix('%127[^']' , %127[nul]", domain, expected_regdom) != 2)
|
||||||
|
@ -130,7 +128,7 @@ static void test_psl(void)
|
||||||
|
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
} else {
|
} else {
|
||||||
printf("Failed to open %s\n", TESTDATA);
|
printf("Failed to open %s\n", PSL_TESTFILE);
|
||||||
failed++;
|
failed++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue