krb5 commit: Add profile tests for final nodes

Greg Hudson <[email protected]>
Newsgroups gmane.comp.encryption.kerberos.cvs
Message-ID <[email protected]>
https://github.com/krb5/krb5/commit/63fe2905901fa8b06cfccb8f8fe136d556e8cb6c
commit 63fe2905901fa8b06cfccb8f8fe136d556e8cb6c
Author: Greg Hudson <[email protected]>
Date:   Mon Jul 15 15:09:30 2019 -0400

    Add profile tests for final nodes

 src/util/profile/Makefile.in    |   20 ++++++++++++++++++--
 src/util/profile/final.expected |   12 ++++++++++++
 src/util/profile/final1.ini     |    6 ++++++
 src/util/profile/final2.ini     |    7 +++++++
 src/util/profile/final3.ini     |    6 ++++++
 src/util/profile/final4.ini     |    6 ++++++
 src/util/profile/final5.ini     |    5 +++++
 7 files changed, 60 insertions(+), 2 deletions(-)

diff --git a/src/util/profile/Makefile.in b/src/util/profile/Makefile.in
index ba589c4..079443e 100644
--- a/src/util/profile/Makefile.in
+++ b/src/util/profile/Makefile.in
@@ -129,7 +129,7 @@ profile_tcl: profile_tcl.o $(PROF_DEPLIB) $(COM_ERR_DEPLIB) $(SUPPORT_DEPLIB)
 clean-unix:: clean-libs clean-libobjs
 	$(RM) $(PROGS) *.o *~ core prof_err.h profile.h prof_err.c
 	$(RM) test_load test_parse test_profile test_vtable profile_tcl
-	$(RM) modtest.conf testinc.ini testinc2.ini
+	$(RM) modtest.conf testinc.ini testinc2.ini final.out
 	$(RM) -r test_include_dir
 
 clean-windows::
@@ -140,7 +140,23 @@ check-unix: test_parse test_profile test_vtable test_load modtest.conf
 	$(RUN_TEST) ./test_load
 
 DO_TCL=@DO_TCL@
-check-unix: check-unix-tcl-$(DO_TCL)
+check-unix: check-unix-final check-unix-tcl-$(DO_TCL)
+
+F1=$(srcdir)/final1.ini
+F2=$(srcdir)/final2.ini
+F3=$(srcdir)/final3.ini
+F4=$(srcdir)/final4.ini
+F5=$(srcdir)/final5.ini
+QUERY=query section subsection key
+check-unix-final: test_profile
+	$(RM) final.out
+	(echo; $(RUN_TEST) ./test_profile $(F1):$(F1) $(QUERY)) > final.out
+	(echo; $(RUN_TEST) ./test_profile $(F2):$(F1) $(QUERY)) >> final.out
+	(echo; $(RUN_TEST) ./test_profile $(F3):$(F1) $(QUERY)) >> final.out
+	(echo; $(RUN_TEST) ./test_profile $(F4):$(F1) $(QUERY)) >> final.out
+	(echo; $(RUN_TEST) ./test_profile $(F5):$(F1) $(QUERY)) >> final.out
+	cmp final.out $(srcdir)/final.expected
+	$(RM) final.out
 
 check-unix-tcl-:
 	@echo "+++"
diff --git a/src/util/profile/final.expected b/src/util/profile/final.expected
new file mode 100644
index 0000000..fb23b3c
--- /dev/null
+++ b/src/util/profile/final.expected
@@ -0,0 +1,12 @@
+
+value1
+value1
+
+value2
+value1
+
+value3
+
+value4
+
+value5
diff --git a/src/util/profile/final1.ini b/src/util/profile/final1.ini
new file mode 100644
index 0000000..0419add
--- /dev/null
+++ b/src/util/profile/final1.ini
@@ -0,0 +1,6 @@
+# A basic profile setting a single relation in a subsection, with
+# nothing marked final.
+[section]
+	subsection = {
+		key = value1
+	}
diff --git a/src/util/profile/final2.ini b/src/util/profile/final2.ini
new file mode 100644
index 0000000..4b1e15b
--- /dev/null
+++ b/src/util/profile/final2.ini
@@ -0,0 +1,7 @@
+# In this variant the relation is marked final.  There is parsing
+# support for this but no iteration or dumping support, so the marker
+# currently has no effect.
+[section]
+	subsection = {
+		key* = value2
+	}
diff --git a/src/util/profile/final3.ini b/src/util/profile/final3.ini
new file mode 100644
index 0000000..dcf0ca9
--- /dev/null
+++ b/src/util/profile/final3.ini
@@ -0,0 +1,6 @@
+# In this variant the subsection is marked final via a '*' at the end
+# of the tag name.
+[section]
+	subsection* = {
+		key = value3
+	}
diff --git a/src/util/profile/final4.ini b/src/util/profile/final4.ini
new file mode 100644
index 0000000..dcba078
--- /dev/null
+++ b/src/util/profile/final4.ini
@@ -0,0 +1,6 @@
+# In this variant the subsection is marked final via a '*' after the
+# closing brace.
+[section]
+	subsection = {
+		key = value4
+	}*
diff --git a/src/util/profile/final5.ini b/src/util/profile/final5.ini
new file mode 100644
index 0000000..58cd57d
--- /dev/null
+++ b/src/util/profile/final5.ini
@@ -0,0 +1,5 @@
+# In this variant the top-level section is marked final.
+[section]*
+	subsection = {
+		key = value5
+	}
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.