Skip to content

Commit 0cb06dc

Browse files
committed
selftests: net: rebuild YNL if dependencies changed
Try to rebuild YNL if either user added a new family or the specs of the families have changed. Stanislav's ncdevmem cause a false positive build failure in NIPA because libynl.a isn't rebuilt after ethtool is added to YNL_GENS. Note that sha1sum is already used in other parts of the build system. Acked-by: Stanislav Fomichev <sdf@fomichev.me> Link: https://patch.msgid.link/20241011230311.2529760-1-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent 2a22bea commit 0cb06dc

File tree

1 file changed

+13
-2
lines changed
  • tools/testing/selftests/net

1 file changed

+13
-2
lines changed

tools/testing/selftests/net/ynl.mk

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,28 @@
99
# YNL_GEN_FILES: TEST_GEN_FILES which need YNL
1010

1111
YNL_OUTPUTS := $(patsubst %,$(OUTPUT)/%,$(YNL_GEN_FILES))
12+
YNL_SPECS := \
13+
$(patsubst %,$(top_srcdir)/Documentation/netlink/specs/%.yaml,$(YNL_GENS))
1214

1315
$(YNL_OUTPUTS): $(OUTPUT)/libynl.a
1416
$(YNL_OUTPUTS): CFLAGS += \
1517
-I$(top_srcdir)/usr/include/ $(KHDR_INCLUDES) \
1618
-I$(top_srcdir)/tools/net/ynl/lib/ \
1719
-I$(top_srcdir)/tools/net/ynl/generated/
1820

19-
$(OUTPUT)/libynl.a:
21+
# Make sure we rebuild libynl if user added a new family. We can't easily
22+
# depend on the contents of a variable so create a fake file with a hash.
23+
YNL_GENS_HASH := $(shell echo $(YNL_GENS) | sha1sum | cut -c1-8)
24+
$(OUTPUT)/.libynl-$(YNL_GENS_HASH).sig:
25+
$(Q)rm -f $(OUTPUT)/.libynl-*.sig
26+
$(Q)touch $(OUTPUT)/.libynl-$(YNL_GENS_HASH).sig
27+
28+
$(OUTPUT)/libynl.a: $(YNL_SPECS) $(OUTPUT)/.libynl-$(YNL_GENS_HASH).sig
29+
$(Q)rm -f $(top_srcdir)/tools/net/ynl/libynl.a
2030
$(Q)$(MAKE) -C $(top_srcdir)/tools/net/ynl GENS="$(YNL_GENS)" libynl.a
2131
$(Q)cp $(top_srcdir)/tools/net/ynl/libynl.a $(OUTPUT)/libynl.a
2232

2333
EXTRA_CLEAN += \
2434
$(top_srcdir)/tools/net/ynl/lib/__pycache__ \
25-
$(top_srcdir)/tools/net/ynl/lib/*.[ado]
35+
$(top_srcdir)/tools/net/ynl/lib/*.[ado] \
36+
$(OUTPUT)/.libynl-*.sig

0 commit comments

Comments
 (0)