From 732b33f8ae4ecc9d7a9f07fd4cb74a60a2a5e2c2 Mon Sep 17 00:00:00 2001
From: Tom Lane <tgl@sss.pgh.pa.us>
Date: Fri, 24 Apr 2015 17:13:06 -0400
Subject: [PATCH] Fix up .gitignore and cleanup actions in some src/test/
 subdirectories.

examples/, locale/, and thread/ lacked .gitignore files and were also
not connected up to top-level "make clean" etc.  This had escaped notice
because none of those directories are built in normal scenarios.  Still,
they have working Makefiles, so if someone does a "make" in one of these
directories it would be good if (a) git doesn't bleat about the product
files and (b) cleaning up removes them.

This is a longstanding oversight, but since this behavior is probably
only of interest to developers, there seems no need for back-patching.

Michael Paquier and Tom Lane
---
 src/test/Makefile            | 7 ++++---
 src/test/examples/.gitignore | 6 ++++++
 src/test/examples/Makefile   | 4 ++--
 src/test/locale/.gitignore   | 1 +
 src/test/locale/Makefile     | 4 ++--
 src/test/thread/.gitignore   | 1 +
 6 files changed, 16 insertions(+), 7 deletions(-)
 create mode 100644 src/test/examples/.gitignore
 create mode 100644 src/test/locale/.gitignore
 create mode 100644 src/test/thread/.gitignore

diff --git a/src/test/Makefile b/src/test/Makefile
index b7cddc8952..b713c2c9c6 100644
--- a/src/test/Makefile
+++ b/src/test/Makefile
@@ -14,9 +14,10 @@ include $(top_builddir)/src/Makefile.global
 
 SUBDIRS = regress isolation modules
 
-# The SSL suite is not secure to run on a multi-user system, so don't run
-# it as part of global "check" target.
-ALWAYS_SUBDIRS = ssl
+# We don't build or execute examples/, locale/, or thread/ by default,
+# but we do want "make clean" etc to recurse into them.  Likewise for ssl/,
+# because the SSL test suite is not secure to run on a multi-user system.
+ALWAYS_SUBDIRS = examples locale thread ssl
 
 # We want to recurse to all subdirs for all standard targets, except that
 # installcheck and install should not recurse into the subdirectory "modules".
diff --git a/src/test/examples/.gitignore b/src/test/examples/.gitignore
new file mode 100644
index 0000000000..1957ec198f
--- /dev/null
+++ b/src/test/examples/.gitignore
@@ -0,0 +1,6 @@
+/testlibpq
+/testlibpq2
+/testlibpq3
+/testlibpq4
+/testlo
+/testlo64
diff --git a/src/test/examples/Makefile b/src/test/examples/Makefile
index aee5c04407..31da210a31 100644
--- a/src/test/examples/Makefile
+++ b/src/test/examples/Makefile
@@ -18,5 +18,5 @@ PROGS = testlibpq testlibpq2 testlibpq3 testlibpq4 testlo testlo64
 
 all: $(PROGS)
 
-clean:
-	rm -f $(PROGS)
+clean distclean maintainer-clean:
+	rm -f $(PROGS) *.o
diff --git a/src/test/locale/.gitignore b/src/test/locale/.gitignore
new file mode 100644
index 0000000000..620d3df425
--- /dev/null
+++ b/src/test/locale/.gitignore
@@ -0,0 +1 @@
+/test-ctype
diff --git a/src/test/locale/Makefile b/src/test/locale/Makefile
index c71dc2dbbf..26ec5c9a90 100644
--- a/src/test/locale/Makefile
+++ b/src/test/locale/Makefile
@@ -10,8 +10,8 @@ DIRS = de_DE.ISO8859-1 gr_GR.ISO8859-7 koi8-r koi8-to-win1251
 
 all: $(PROGS)
 
-clean:
-	rm -f $(PROGS)
+clean distclean maintainer-clean:
+	rm -f $(PROGS) *.o
 	for d in $(DIRS); do \
 		$(MAKE) -C $$d clean || exit; \
 	done
diff --git a/src/test/thread/.gitignore b/src/test/thread/.gitignore
new file mode 100644
index 0000000000..1d54d546a8
--- /dev/null
+++ b/src/test/thread/.gitignore
@@ -0,0 +1 @@
+/thread_test