Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#1277 closed defect (fixed)

src/lib/datasrc/tests unittest failure due to missing testdata

Reported by: jreed Owned by: jreed
Priority: low Milestone: Sprint-20111025
Component: Unclassified Version:
Keywords: Cc:
CVSS Scoring: Parent Tickets:
Sensitive: no Defect Severity: N/A
Sub-Project: DNS Feature Depending on Ticket:
Estimated Difficulty: 0 Add Hours to Ticket: 0
Total Hours: 0 Internal?: no

Description

In src/lib/datasrc/tests, if I run: 1) "make clean; make ; make check" it works. 2) "make clean ; make check" always fails.

The error is:

[----------] 43 tests from DatabaseClientTest/1, where TypeParam = (anonymous namespace)::TestSQLite3Accessor
[ RUN      ] DatabaseClientTest/1.zoneNotFound
terminate called after throwing an instance of 'isc::datasrc::DataSourceError'
  what():  adding record to SQLite3 data source without transaction
[1]   Abort trap (core dumped) ${dir}${tst}

The only difference between a success and failure is the rwtest.sqlite3.copied file.

A diff of the output between the two tests (until the failure) is only:

-Making all in testdata
-../../../../../install-sh -m 644 ./rwtest.sqlite3 rwtest.sqlite3.copied
-make  all-am
-Making check in .

My fix is to make sure it descends into testdata directory first and use a check-local target:

diff --git a/src/lib/datasrc/tests/Makefile.am b/src/lib/datasrc/tests/Makefile.am
index 10e1add..92a5978 100644
--- a/src/lib/datasrc/tests/Makefile.am
+++ b/src/lib/datasrc/tests/Makefile.am
@@ -1,4 +1,4 @@
-SUBDIRS = . testdata
+SUBDIRS = testdata
 
 AM_CPPFLAGS = -I$(top_srcdir)/src/lib -I$(top_builddir)/src/lib
 AM_CPPFLAGS += -I$(top_builddir)/src/lib/dns -I$(top_srcdir)/src/lib/dns
diff --git a/src/lib/datasrc/tests/testdata/Makefile.am b/src/lib/datasrc/tests/testdata/Makefile.am
index 64ae955..8d382f3 100644
--- a/src/lib/datasrc/tests/testdata/Makefile.am
+++ b/src/lib/datasrc/tests/testdata/Makefile.am
@@ -1,6 +1,7 @@
 CLEANFILES = *.copied
-BUILT_SOURCES = rwtest.sqlite3.copied
+EXTRA_DIST = rwtest.sqlite3.copied
 
 # We use install-sh with the -m option to make sure it's writable
-rwtest.sqlite3.copied: $(srcdir)/rwtest.sqlite3
-	$(top_srcdir)/install-sh -m 644 $(srcdir)/rwtest.sqlite3 $@
+check-local:
+	$(top_srcdir)/install-sh -m 644 $(srcdir)/rwtest.sqlite3 \
+		rwtest.sqlite3.copied

Note that the second patch is not needed. The only change needed it to descend into testdata before doing checks in current directory.

May I push this to master?

By the way, why do we have other Makefile.am files with SUBDIRS with period at end of list or only item of list? These all seem superfluous.

Subtickets

Change History (4)

comment:1 Changed 8 years ago by jreed

  • Owner set to UnAssigned
  • Status changed from new to reviewing

comment:2 Changed 8 years ago by jelte

  • Owner changed from UnAssigned to jreed

It works, and imo can be merged, but just wondering, shouldn't it really clean the file in clean-local instead of adding it to EXTRA_DIST?

comment:3 Changed 8 years ago by jreed

  • Resolution set to fixed
  • Status changed from reviewing to closed

Well I fixed it with my commit 2e74ee9f329249738ddf00599090f94ef80eecc1. I forgot about this ticket when I did that commit. I will ignore the second part of the patch and close this ticket.

comment:4 Changed 8 years ago by shane

  • Milestone changed from New Tasks to Sprint-20111025
Note: See TracTickets for help on using tickets.