selftest: Fix build errors
Subsystems (3)
cover selftest: Fix build errors
This patchset fixes build errors in selftest.
SeongJae Park (3):
selftest/memfd/Makefile: Fix build error selftest/intel_pstate/aperf: Use LDLIBS instead of LDFLAGS selftest/net/Makefile: Specify output with $(OUTPUT)
tools/testing/selftests/intel_pstate/Makefile | 2 +- tools/testing/selftests/memfd/Makefile | 2 +- tools/testing/selftests/net/Makefile | 3 +-- 3 files changed, 3 insertions(+), 4 deletions(-)
Signature · 1 line
2.13.0
PATCH 1/3 selftest/memfd/Makefile: Fix build error
Selftest for memfd shows build error as below:
``` gcc -D_FILE_OFFSET_BITS=64 -I../../../../include/uapi/ -I../../../../include/ -I../../../../usr/include/ fuse_mnt.c -o /home/sjpark/linux/tools/testing/selftests/memfd/fuse_mnt /tmp/cc6NHdwJ.o: In function `main': fuse_mnt.c:(.text+0x249): undefined reference to `fuse_main_real' collect2: error: ld returned 1 exit status ```
The build fails because output file is specified without $(OUTPUT) and LDFLAGS is used though Makefile implicit rule is used. This commit fixes the error by specifying output file path with $(OUTPUT) and using LDLIBS instead of LDFLAGS.
--- tools/testing/selftests/memfd/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/memfd/Makefile +1 -1
@@ -7,7 +7,7 @@ TEST_PROGS := run_fuse_test.sh TEST_GEN_FILES := memfd_test fuse_mnt fuse_test fuse_mnt.o: CFLAGS += $(shell pkg-config fuse --cflags) -fuse_mnt: LDFLAGS += $(shell pkg-config fuse --libs) include ../lib.mk +$(OUTPUT)/fuse_mnt: LDLIBS += $(shell pkg-config fuse --libs)
Signature · 1 line
2.13.0
PATCH 2/3 selftest/intel_pstate/aperf: Use LDLIBS instead of LDFLAGS
In reply to SeongJae ParkBuild of aperf fails as below:
``` gcc -Wall -D_GNU_SOURCE -lm aperf.c -o /tools/testing/selftests/intel_pstate/aperf /tmp/ccKf3GF6.o: In function `main': aperf.c:(.text+0x278): undefined reference to `sqrt' collect2: error: ld returned 1 exit status ```
The faulure occurs because -lm was defined as LDFLAGS and implicit rule of make places LDFLAGS before source file. This commit fixes the problem by using LDLIBS instead of LDFLAGS.
--- tools/testing/selftests/intel_pstate/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/intel_pstate/Makefile +1 -1
@@ -1,5 +1,5 @@ CFLAGS := $(CFLAGS) -Wall -D_GNU_SOURCE -LDFLAGS := $(LDFLAGS) -lm +LDLIBS := $(LDLIBS) -lm TEST_GEN_FILES := msr aperf
Signature · 1 line
2.13.0
PATCH 3/3 selftest/net/Makefile: Specify output with $(OUTPUT)
In reply to SeongJae ParkAfter commit a8ba798bc8ec ("selftests: enable O and KBUILD_OUTPUT"), net selftest build fails because it points output file without $(OUTPUT) yet. This commit fixes the error.
--- tools/testing/selftests/net/Makefile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
tools/testing/selftests/net/Makefile +1 -2
@@ -3,8 +3,6 @@ CFLAGS = -Wall -Wl,--no-as-needed -O2 -g CFLAGS += -I../../../../usr/include/ -reuseport_bpf_numa: LDFLAGS += -lnuma - TEST_PROGS := run_netsocktests run_afpackettests test_bpf.sh netdevice.sh TEST_GEN_FILES = socket TEST_GEN_FILES += psock_fanout psock_tpacket
@@ -13,3 +11,4 @@ TEST_GEN_FILES += reuseport_dualstack include ../lib.mk +$(OUTPUT)/reuseport_bpf_numa: LDFLAGS += -lnuma
Signature · 1 line
2.13.0
Re: [PATCH 3/3] selftest/net/Makefile: Specify output with $(OUTPUT)
From: SeongJae Park <[email protected]>
Date: Sun, 18 Jun 2017 09:56:04 +0900
Quoted 6 lines
After commit
a8ba798bc8ec("selftests: enable O andKBUILD_OUTPUT"), net selftest build fails because it points output file without $(OUTPUT) yet. This commit fixes the error.Signed-off-by SeongJae Park <[email protected]>Fixes a8ba798bc8ec ("selftests: enable O and KBUILD_OUTPUT")