Commit Graph

99 Commits

Author SHA1 Message Date
Loïc Yhuel aa4909766c Make builtin option independant from runtime one
Since commit deabd4a, psl2c has been replaced by psl-make-dafsa.
The builtin PSL data is always generated the same way, and the value of the builtin
configure option does not matter anymore.

The built-in data is now embedded by default (instead of the previous "auto"), unless
explicitly disabled by --disable-builtin/-Dbuiltin=false.

When not using an run-time runtime IDNA library (--disable-runtime/-Druntime=no), libpsl can
now include the built-in data without any build-time dependency.
2022-06-06 22:48:32 +02:00
Alexey Rochev 1159bd46c3 meson: fix tests/tools link errors when building shared library for Windows
We need to link them with ws2_32 explicitly.
2022-01-13 01:55:03 +03:00
Alexey Rochev ba6f11f751 meson: automatically add PSL_STATIC define when building Windows static library 2022-01-13 01:54:38 +03:00
Alexey Rochev 02c8476071 Use C++ linker when building with libicu
ICU is a C++ library, event though it has C interface.
Therefore we have to use C++ linker when linking with it.
2022-01-07 01:12:17 +03:00
Alexey Rochev 5a29a64444 Remove libicu includes from test-registrable-domain.c
It doesn't seem like they are used,
and they cause build failures with meson.
2022-01-06 03:03:43 +03:00
Tim Rühsen f5035b854b Add WSAStartup() for Windows psl tool and tests.
As reported at https://github.com/rockdaboot/libpsl/issues/173,
psl_is_cookie_domain_acceptable() doesn't work properly without
WSAStartup() on Windows.

Co-authored-by: gvanem@yahoo.no
2021-11-26 19:10:37 +01:00
Nikola Kotur f364cea73e Update Platform.sh example in test data 2020-07-02 17:04:27 +02:00
Matthew Waters a10c374dad meson: run python script against the meson version of python
Avoids using a python that may not exist in a python3 only distribution:

/usr/bin/env: ‘python’: No such file or directory
2020-04-02 15:16:20 +11:00
Ross Burton b4fec5d0dd Makefile.am: use PYTHON when invoking psl-make-dafsa
In an environment where only Python 3 is installed, configure.ac finds and sets
PYTHON=python3 correctly but src/psl-make-dafsa is called directly, so the hashbang of
`#!/usr/bin/env python` is used which doesn't exist.

Fix this by explicitly running $(PYTHON) when using the tool.
2019-07-11 17:47:11 +01:00
Po-Chuan Hsieh 9347024221
Fix build when configured with --with-psl-file
The error message is as follows:
Making all in tests
make: don't know how to make ../list/public_suffix_list.dat. Stop

make: stopped in /usr/ports/works/usr/ports/dns/libpsl/work/libpsl-libpsl-0.21.0/tests
*** Error code 1

Stop.
2019-04-17 13:25:48 +00:00
Tim Rühsen 94a7e7c6ed Include meson build files into tarball 2019-04-17 12:05:00 +02:00
Tim Rühsen 46a990736c Create test DAFSAs if older than public_suffix_list.dat 2019-04-05 15:08:32 +02:00
Tim Rühsen ad895e382a Silence format warning on printing time_t 2018-12-31 16:51:48 +01:00
Tim Rühsen c9315f26bc Fix typos 2018-12-28 19:44:39 +01:00
Chun-wei Fan df873db543 meson: Ensure things build with Windows
We must link to ws2_32.lib for all Windows builds, and we need to use
workarounds for alloca() and snprintf() since Visual Studio uses
_alloca() for alloca() and provides snprintf() only on Visual Studio
2015 or later, meaning that we need to use _snprintf() here.

Also fix the parts where we run the Python scripts to generate items,
since those scripts already have shebang lines for Meson to pick up.
2018-12-11 09:28:51 +08:00
Tim Rühsen 04da21e2e9 Meson: Include config.h in tests 2018-12-09 14:33:56 +01:00
Xavier Claessens ed5f23d69a Meson: Fix srcdir pointing to root source dir instead of current subdir 2018-12-08 12:49:20 -05:00
Xavier Claessens 77c10beab7 Add initial Meson build system 2018-12-07 09:54:20 -05:00
Xavier Claessens aff5cef20e tests: Do not hardcode psl.dafsa and psl_ascii.dafsa file names 2018-12-06 09:11:56 -05:00
Tim Rühsen 44256b1a3a Make global vars static in test-is-public-all.c 2018-04-19 10:21:25 +02:00
Tim Rühsen c4a2698e22 Remove unused vars in test-is-public-all.c 2018-04-19 10:15:53 +02:00
Tim Rühsen 8fd480584e Fix PSL_TYPE_NO_STAR_RULE and improve test suite
Reported-by: Daniel Kahn Gillmor
2018-02-23 12:09:07 +01:00
Tim Rühsen 43ec750b40 Update copyrights 2018-02-22 10:04:00 +01:00
Claudio Saavedra 49707dc3b3 Add tests for PSL_TYPE_NO_STAR_RULE 2018-02-21 20:48:05 +01:00
Darshit Shah 4d5982ed98 Add new function psl_free_string()
When writing a wrapper around LibPSL in a different language it is
important that libpsl provide functions to free any memory that it
allocates. Without this, it is impossible to correctly free the memory
allocated by psl_str_to_utf8lower() function since in other languages
one may not have access to the same free() call from libc.
2017-08-30 11:07:04 +02:00
Tim Rühsen e20e6f369b Add clang's CFI instrumentation
Add --enable-cfi ./configure option to enable
LLVM/Clang's Control Flow Integrity for builds.

CFI aborts a program upon detecting certain forms of undefined behavior
that can potentially allow attackers to subvert the program’s control flow.
2017-06-19 17:14:29 +02:00
Tim Rühsen 31684dc7fd Add psl_latest() and psl_dist_filename() to tests 2017-01-04 17:10:57 +01:00
Zhang Hai 00f628d802 s/Publix/Public/ 2016-12-07 16:14:04 +08:00
Tim Rühsen deabd4a546 Replace psl2c by psl-make-dafsa
Removed --input-format from psl-make-dafsa.
Added --output-format=cxx+ to psl-make-dafsa.
Removed psl2c.
2016-12-06 15:22:18 +01:00
Tim Rühsen 6490b8214b Don't taint out variable on error in psl_str_to_utf8lower()
Fixes #71
2016-12-05 16:28:47 +01:00
Tim Rühsen 2c871b1306 Skip conversion in _psl_is_public_suffix() for builtin psl context 2016-11-06 11:59:36 +01:00
Tim Rühsen 70661c6807 Add checking with ASCII DAFSA in test-is-public-all.c 2016-11-06 11:30:20 +01:00
Tim Rühsen e30e77ef12 Create ASCII and UTF-8 binaries for testing 2016-11-05 11:17:11 +01:00
Tim Rühsen 598a78b2de Add better test code coverage 2016-09-26 15:15:34 +02:00
Tim Rühsen 1baaacccd5 Fix libidn/libidn2 code path of psl_str_to_utf8lower()
* fixing memory leaks
* proper handling of unterminated results of u8_tolower()
* second call to iconv() ensures flush of internal memory
* check more code paths of psl_str_to_utf8lower() via
  tests/test-registrable-domain.c
2016-09-23 12:35:08 +02:00
Tim Rühsen 4798ee88a2 Add test suite support for list/tests/tests.txt 2016-02-20 15:06:48 +01:00
Tim Rühsen 95a5152e56 Update copyright year to 2016 2016-01-02 13:36:49 +01:00
Tim Rühsen 9f420e2d91 Add tests against the built-in PSL to test-is-public-all.c 2016-01-01 23:26:44 +01:00
Tim Rühsen 5c159a3a09 Add few more tests to test-is-public-builtin.c 2016-01-01 22:34:55 +01:00
Tim Rühsen cde5e53ea6 Remove psl_builtin_compile_time() for reproducable builds 2016-01-01 15:44:24 +01:00
Tim Rühsen 9d2e93f0b8 New function psl_is_public_suffix2()
The current PSL has two sections, ICANN and PRIVATE.
This new function allows to limit the check for one or both
of these sections.
2015-12-06 21:55:56 +01:00
Tim Rühsen 519b8c9d17 Add time measurement for test-is-public-all.c 2015-12-03 10:08:04 +01:00
Tim Rühsen f3b479fd45 Remove -DDATADIR from DEFS in tests/Makefile.am 2015-11-19 11:14:31 +01:00
Tim Rühsen 53c2fe31a8 Update copyright years 2015-09-23 14:50:01 +02:00
Tim Rühsen 4c8d3c4d73 Remove unused variable from tests/test-is-public-all.c 2015-09-15 15:16:04 +02:00
Tim Rühsen fa55bb75c4 Removed test with wrong assumptions 2015-09-15 14:46:07 +02:00
Tim Rühsen 0652af910e Fix SIGSEGV in test-is-public-all.c for TLD exceptions 2015-09-15 12:19:18 +02:00
Tim Rühsen 7b72ac673b Skip leading whitespaces in tests_psl.txt 2015-08-14 12:27:11 +02:00
Daniel Kahn Gillmor c1b52ee2d8 Expect more from test_psl.txt
There were some tests included in test_psl.txt that we were not
covering because they didn't match our expectations.

Cover all the tests in test_psl that we know about, and count unknown
lines as failed tests.
2015-08-13 18:02:11 -04:00
Tim Rühsen 71835fcd44 Add https://github.com/publicsuffix as git submodule 2015-07-14 13:25:42 +02:00