summaryrefslogtreecommitdiffstats
path: root/tests/t-triggers-db/Makefile
blob: c0766d6cf8a38ba18d4ee1e3742ce8374bd951c8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
TESTS_DEB := pkg-triggers-native pkg-triggers-foreign pkg-triggers-same

include ../Test.mk

TEST_CASES += test-trigger-db-native-to-same
TEST_CASES += test-trigger-db-foreign-to-same
TEST_CASES += test-trigger-db-same-to-same

test-case: $(TEST_CASES)

test-trigger-db-native-to-same: override DPKG_ADMINDIR = db-native
test-trigger-db-native-to-same:
	cp -a tmpl-$(DPKG_ADMINDIR) $(DPKG_ADMINDIR)
	$(call stdout_is,cat "$(DPKG_ADMINDIR)/triggers/a-trigger",pkg-triggers)
	$(call stdout_is,cat "$(DPKG_ADMINDIR)/triggers/File",/triggers pkg-triggers)
	$(DPKG_INSTALL) pkg-triggers-native.deb
	$(call stdout_is,cat "$(DPKG_ADMINDIR)/triggers/a-trigger",pkg-triggers/noawait)
	grep -q "^/triggers pkg-triggers/noawait$$" "$(DPKG_ADMINDIR)/triggers/File"
	$(DPKG_INSTALL) pkg-triggers-same.deb
	$(call stdout_is,cat "$(DPKG_ADMINDIR)/triggers/a-trigger",pkg-triggers:amd64/noawait)
	$(call stdout_is,cat "$(DPKG_ADMINDIR)/triggers/File",/triggers pkg-triggers:amd64/noawait)
	$(DPKG_PURGE) pkg-triggers

test-trigger-db-foreign-to-same: override DPKG_ADMINDIR = db-foreign
test-trigger-db-foreign-to-same:
	cp -a tmpl-$(DPKG_ADMINDIR) $(DPKG_ADMINDIR)
	$(call stdout_is,cat "$(DPKG_ADMINDIR)/triggers/a-trigger",pkg-triggers:other)
	$(call stdout_is,cat "$(DPKG_ADMINDIR)/triggers/File",/triggers pkg-triggers:other)
	: # The db needs to be reproducible, so it gets normalized on upgrade.
	$(DPKG_INSTALL) pkg-triggers-foreign.deb
	$(call stdout_is,cat "$(DPKG_ADMINDIR)/triggers/a-trigger",pkg-triggers/noawait)
	$(call stdout_is,cat "$(DPKG_ADMINDIR)/triggers/File",/triggers pkg-triggers/noawait)
	$(DPKG_INSTALL) pkg-triggers-same.deb
	$(call stdout_is,cat "$(DPKG_ADMINDIR)/triggers/a-trigger",pkg-triggers:amd64/noawait)
	$(call stdout_is,cat "$(DPKG_ADMINDIR)/triggers/File",/triggers pkg-triggers:amd64/noawait)
	$(DPKG_PURGE) pkg-triggers

test-trigger-db-same-to-same: override DPKG_ADMINDIR = db-same
test-trigger-db-same-to-same:
	cp -a tmpl-$(DPKG_ADMINDIR) $(DPKG_ADMINDIR)
	$(call stdout_is,cat "$(DPKG_ADMINDIR)/triggers/a-trigger",pkg-triggers:amd64)
	$(call stdout_is,cat "$(DPKG_ADMINDIR)/triggers/File",/triggers pkg-triggers:amd64)
	$(DPKG_INSTALL) pkg-triggers-same.deb
	$(call stdout_is,cat "$(DPKG_ADMINDIR)/triggers/a-trigger",pkg-triggers:amd64/noawait)
	$(call stdout_is,cat "$(DPKG_ADMINDIR)/triggers/File",/triggers pkg-triggers:amd64/noawait)
	$(DPKG_PURGE) pkg-triggers

test-clean:
	$(DPKG_PURGE) pkg-triggers
	$(RM) -r db-native db-foreign db-same