diff --git a/xapian-core/tests/api_backend.cc b/xapian-core/tests/api_backend.cc
index d080bf9..60554c3 100644
--- a/xapian-core/tests/api_backend.cc
+++ b/xapian-core/tests/api_backend.cc
@@ -35,6 +35,7 @@
 #include "apitest.h"
 
 #include "safeunistd.h"
+#include <csignal>
 
 using namespace std;
 
@@ -750,3 +751,34 @@ DEFINE_TESTCASE(tradweight2, backend) {
     }
     return true;
 }
+
+class IgnoreSIGHUP {
+    struct sigaction old_handler;
+
+  public:
+    IgnoreSIGHUP() {
+	struct sigaction handler;
+	handler.sa_handler = SIG_IGN;
+	sigemptyset(&handler.sa_mask);
+	handler.sa_flags = SA_RESTART;
+	sigaction(SIGHUP, &handler, &old_handler);
+    }
+
+    ~IgnoreSIGHUP() {
+	sigaction(SIGHUP, &old_handler, NULL);
+    }
+};
+
+// FIXME: if the alarm fires, we don't get a chance to unignore SIGHUP...
+DEFINE_TESTCASE(ignoresighup1, brass || chert || flint) {
+    IgnoreSIGHUP ignore_sighup;
+    alarm(5);
+    {
+	// With 1.2.5 and earlier, this would hang waiting for the child lock
+	// process to exit because the parent sent SIGHUP but the child was
+	// ignoring it.
+	Xapian::WritableDatabase db(get_writable_database());
+    }
+    alarm(0);
+    return true;
+}

