[PATCH:makedepend 2/2] Convert testcase from bug 28045 into automake "make check" test

Alan Coopersmith alan.coopersmith at oracle.com
Fri May 14 21:23:30 PDT 2010


Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
---
 Makefile.am            |   20 ++++++++++++++++++++
 tests/28045/foo.cpp    |    2 ++
 tests/28045/makedep.sh |   28 ++++++++++++++++++++++++++++
 3 files changed, 50 insertions(+), 0 deletions(-)
 create mode 100644 tests/28045/foo.cpp
 create mode 100755 tests/28045/makedep.sh

diff --git a/Makefile.am b/Makefile.am
index 91893c4..c697271 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -68,3 +68,23 @@ ALL_LINT_FLAGS=$(LINT_FLAGS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
 lint:
 	$(LINT) $(ALL_LINT_FLAGS) $(makedepend_SOURCES)
 endif LINT
+
+### Test cases - mostly for bug fixes submitted with a test case so far
+TESTS =
+
+# Absolute path to srcdir & builddir top that test scripts can reference
+TEST_BUILDDIR_PATH = `cd $(top_builddir) && pwd`
+TEST_SRCDIR_PATH = `cd $(top_srcdir) && pwd`
+
+# Path to makedepend command being tested that can be found from test subdirs
+TESTS_ENVIRONMENT = MAKEDEPEND="$(TEST_BUILDDIR_PATH)/makedepend"
+
+# Path to writable testdirectory in build directory
+TESTS_ENVIRONMENT += test_builddir="$(TEST_BUILDDIR_PATH)/tests"
+
+# Path to testcase files in source directory
+TESTS_ENVIRONMENT += test_srcdir="$(TEST_SRCDIR_PATH)/tests"
+
+# Test for https://bugs.freedesktop.org/show_bug.cgi?id=28045
+TESTS += tests/28045/makedep.sh
+EXTRA_DIST += tests/28045/makedep.sh tests/28045/foo.cpp
diff --git a/tests/28045/foo.cpp b/tests/28045/foo.cpp
new file mode 100644
index 0000000..95d2129
--- /dev/null
+++ b/tests/28045/foo.cpp
@@ -0,0 +1,2 @@
+
+#include <one>
diff --git a/tests/28045/makedep.sh b/tests/28045/makedep.sh
new file mode 100755
index 0000000..322e8a0
--- /dev/null
+++ b/tests/28045/makedep.sh
@@ -0,0 +1,28 @@
+#!/bin/sh
+
+# Test case from https://bugs.freedesktop.org/show_bug.cgi?id=28045
+# modified to work with automake test framework
+
+set -e
+
+if [ "x$MAKEDEPEND" == "x" ]; then
+    MAKEDEPEND=makedepend
+fi
+
+mkdir -p ${test_builddir}/28045
+cd ${test_builddir}/28045
+
+# Create test conditions:
+#  - directory named "one"
+#  - directory named "two" containing empty file named "one"
+mkdir one two
+touch two/one
+
+# Happens to work before fix for 28045
+$MAKEDEPEND -f- -- -Itwo -Ione -I. -- ${test_srcdir}/28045/foo.cpp > /dev/null
+
+# Happens to fail before fix for 28045
+$MAKEDEPEND -f- -- -I. -Ione -Itwo -- ${test_srcdir}/28045/foo.cpp > /dev/null
+
+# Clean up
+rm -rf one two
-- 
1.5.6.5



More information about the xorg-devel mailing list