Blob Blame History Raw
From 22820938a43871b7cd634767809faec31d139f27 Mon Sep 17 00:00:00 2001
From: Phil Sutter <psutter@redhat.com>
Date: Fri, 25 Nov 2016 11:45:05 +0100
Subject: [PATCH] Makefile: Make self-test accessible by 'make test'

This will call 'test' three times: The first call makes sure that
KEEPALIVE=off is respected, the last two calls check that environment
variables KEEPCNT, KEEPIDLE and KEEPINTVL are applied as expected.

Signed-off-by: Phil Sutter <psutter@redhat.com>
---
 Makefile      | 3 +++
 test/Makefile | 6 ++++++
 2 files changed, 9 insertions(+)

diff --git a/Makefile b/Makefile
index 524d6a98c8329..01622771d73c5 100644
--- a/Makefile
+++ b/Makefile
@@ -13,6 +13,9 @@ default:
 	cp src/libkeepalive.so libkeepalive.so
 	strip -s libkeepalive.so
 
+test: default
+	make -C test/ runtest
+
 clean:
 	make -C src/ clean
 	make -C test/ clean
diff --git a/test/Makefile b/test/Makefile
index 2a0f6e2780d5e..6baf822c2338d 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -11,5 +11,11 @@ CC=gcc
 
 default: test
 
+TENV = LD_PRELOAD=../libkeepalive.so SELFTEST=on
+runtest:
+	${TENV} KEEPALIVE=off ./test
+	${TENV} KEEPCNT=13 KEEPIDLE=23 KEEPINTVL=42 ./test
+	${TENV} KEEPCNT=42 KEEPIDLE=13 KEEPINTVL=23 ./test
+
 clean:
 	rm -f test
-- 
2.10.0