Commit f852b157 authored by Michael Tremer's avatar Michael Tremer

test: Generate database dynamically

Signed-off-by: default avatarMichael Tremer <michael.tremer@ipfire.org>
parent 01e8fdce
......@@ -14,3 +14,4 @@ Makefile.in
/stamp-h1
/src/python/location-query
/test.db
/testdata.db
......@@ -159,8 +159,8 @@ build-perl:
cd $(builddir)/src/perl && $(MAKE)
.PHONY: check-perl
check-perl:
cd $(builddir)/src/perl && $(MAKE) test srcdir=$(abs_srcdir)
check-perl: testdata.db
cd $(builddir)/src/perl && $(MAKE) test database="../../$<"
.PHONY: install-perl
install-perl:
......@@ -199,10 +199,11 @@ TESTS = \
src/test-network
CLEANFILES += \
test.db
test.db \
testdata.db
EXTRA_DIST += \
testdata/test.db
testdata.db: examples/python/create-database.py
PYTHONPATH=$(abs_builddir)/src/python/.libs $(PYTHON) $< $@
check_PROGRAMS = \
src/test-libloc \
......
#!/usr/bin/python3
import location
import sys
w = location.Writer()
......@@ -27,4 +28,5 @@ n.asn = a.number
print(n)
# Write the database to disk
w.write("test.db")
for f in sys.argv[1:]:
w.write(f)
......@@ -9,7 +9,7 @@ use strict;
use warnings;
# Where to find the test database.
my $testdb = "$ENV{'srcdir'}/testdata/test.db";
my $testdb = $ENV{'database'};
use Test::More tests => 5;
BEGIN { use_ok('Location') };
......
The database in this folder can be used to run various tests against it and
has been created by using the "create-database.py" script in the examples directory.
It contains the following content:
Vendor: "IPFire Project"
Description: "This is a geo location database"
License: "CC"
AS: "AS204867 (Lightning Wire Labs GmbH)"
Subnet: "2a07:1c44:5800::/40"
Country Code: "DE"
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment