Skip to contentSkip to conversation

testsuite: remove all temp files and implement make clean

PATCH In review Luca Boccassi 2 participants 5 messages Aug 22, 2018 – Aug 23, 2018

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/3 testsuite: remove all temp files and implement make clean

Some generated test files were not removed, including one executable in the testsuite/tools directory.
Ensure make clean from the top level directory works for the testsuite subdirs too, and that all the files are removed.

---
 Makefile                 | 2 +-
 testsuite/Makefile       | 3 +++
 testsuite/tools/Makefile | 3 +++
 3 files changed, 7 insertions(+), 1 deletion(-)
Makefile +1 -1
index 651d2a50..ea2f797c 100644
@@ -96,7 +96,7 @@ snapshot:
 		> include/SNAPSHOT.h
 
 clean:
-	@for i in $(SUBDIRS); \
+	@for i in $(SUBDIRS) testsuite; \
 	do $(MAKE) $(MFLAGS) -C $$i clean; done
 
 clobber:
testsuite/Makefile +3 -0
index 8fcbc557..2acd0427 100644
@@ -43,6 +43,9 @@ alltests: $(TESTS)
 clean:
 	@echo "Removing $(RESULTS_DIR) dir ..."
 	@rm -rf $(RESULTS_DIR)
+	@rm -f iproute2/iproute2-this
+	@rm -f tests/ip/link/dev_wo_vf_rate.nl
+	$(MAKE) -C tools clean
 
 distclean: clean
 	echo "Entering iproute2" && cd iproute2 && $(MAKE) distclean && cd ..;
testsuite/tools/Makefile +3 -0
index f2cdc980..f0ce4ee2 100644
@@ -1,3 +1,6 @@
 # SPDX-License-Identifier: GPL-2.0
 generate_nlmsg: generate_nlmsg.c ../../lib/libnetlink.c
 	$(CC) -o $@ $^
+
+clean:
+	rm -f generate_nlmsg
Signature · 1 line
2.18.0
#1 lore raw

PATCH 2/3 testsuite: let make compile build the netlink helper

The generate_nlmsg binary is required but make -C testsuite compile does not build it. Add the necessary includes and C*FLAGS to the tools Makefile and have the compile target build it.

---
 testsuite/Makefile       | 1 +
 testsuite/tools/Makefile | 4 +++-
 2 files changed, 4 insertions(+), 1 deletion(-)
testsuite/Makefile +1 -0
index 2acd0427..5e269877 100644
@@ -32,6 +32,7 @@ configure:
 
 compile: configure
 	echo "Entering iproute2" && cd iproute2 && $(MAKE) && cd ..;
+	$(MAKE) -C tools
 
 listtests:
 	@for t in $(TESTS); do \
testsuite/tools/Makefile +3 -1
index f0ce4ee2..c936af71 100644
@@ -1,6 +1,8 @@
 # SPDX-License-Identifier: GPL-2.0
+include ../../config.mk
+
 generate_nlmsg: generate_nlmsg.c ../../lib/libnetlink.c
-	$(CC) -o $@ $^
+	$(CC) $(CPPFLAGS) $(CFLAGS) $(LDLIBS) $(EXTRA_CFLAGS) -I../../include -include../../include/uapi/linux/netlink.h -o $@ $^
 
 clean:
 	rm -f generate_nlmsg
Signature · 1 line
2.18.0
#2 lore raw

PATCH 3/3 testsuite: run dmesg with sudo

In reply to Luca Boccassi

Some distributions like Debian nowadays restrict the dmesg command to root-only. Run it with sudo in the testsuite.

---
 testsuite/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
testsuite/Makefile +1 -1
index 5e269877..ef45d5a7 100644
@@ -79,5 +79,5 @@ endif
 			echo "PASS"; \
 		fi; \
 		rm "$$TMP_ERR" "$$TMP_OUT"; \
-		dmesg > $(RESULTS_DIR)/$@.$$o.dmesg; \
+		sudo dmesg > $(RESULTS_DIR)/$@.$$o.dmesg; \
 	done
Signature · 1 line
2.18.0
#3 lore raw
In reply to Luca Boccassi
Quoted 7 lines · Luca Boccassi

Some generated test files were not removed, including one executable in the testsuite/tools directory.
Ensure make clean from the top level directory works for the testsuite subdirs too, and that all the files are removed.

---

Patch 1+2 look good to me and I would ack if that would count in any way. For patch 3 I only wonder whether that might re-use $PREFIX (which is defined as "sudo -E unshare -n"). Ok, the unshare part might be slight overkill, but maybe a little better in style. Not sure though, and it is high level whining...

-Stefan

Quoted 44 lines
 Makefile                 | 2 +-
 testsuite/Makefile       | 3 +++
 testsuite/tools/Makefile | 3 +++
 3 files changed, 7 insertions(+), 1 deletion(-)
Makefile +1 -1
index 651d2a50..ea2f797c 100644
@@ -96,7 +96,7 @@ snapshot:
 		> include/SNAPSHOT.h
 
 clean:
-	@for i in $(SUBDIRS); \
+	@for i in $(SUBDIRS) testsuite; \
 	do $(MAKE) $(MFLAGS) -C $$i clean; done
 
 clobber:
testsuite/Makefile +3 -0
index 8fcbc557..2acd0427 100644
@@ -43,6 +43,9 @@ alltests: $(TESTS)
 clean:
 	@echo "Removing $(RESULTS_DIR) dir ..."
 	@rm -rf $(RESULTS_DIR)
+	@rm -f iproute2/iproute2-this
+	@rm -f tests/ip/link/dev_wo_vf_rate.nl
+	$(MAKE) -C tools clean
 
 distclean: clean
 	echo "Entering iproute2" && cd iproute2 && $(MAKE) distclean && cd ..;
testsuite/tools/Makefile +3 -0
index f2cdc980..f0ce4ee2 100644
@@ -1,3 +1,6 @@
 # SPDX-License-Identifier: GPL-2.0
 generate_nlmsg: generate_nlmsg.c ../../lib/libnetlink.c
 	$(CC) -o $@ $^
+
+clean:
+	rm -f generate_nlmsg
#4 lore raw
Quoted 19 lines · Stefan Bader
Quoted 9 lines · Luca Boccassi

Some generated test files were not removed, including one executable in
the testsuite/tools directory.
Ensure make clean from the top level directory works for the testsuite
subdirs too, and that all the files are removed.

---

Patch 1+2 look good to me and I would ack if that would count in any way.
For patch 3 I only wonder whether that might re-use $PREFIX (which is defined as "sudo -E unshare -n"). Ok, the unshare part might be slight
overkill, but maybe a little better in style. Not sure though, and it is high level whining...

Quoted 1 line

-Stefan

Hi,

Yeah I thought about that, but as you noticed it would run it through unshare so I changed it in the end. I don't mind either way - Stephen, let me know which one you prefer.

Signature · 2 lines
Kind regards,
Luca Boccassi