
This patch adds a test for strlen() string.c contains a copy of strlen() from lib/string.c The test first tests the correctness of strlen() by comparing the result with libc strlen(). It tests all cases of alignment. It them tests the duration of an aligned strlen() on a 4 bytes string, on a 16 bytes string and on a 256 bytes string. Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr> [mpe: Drop change log from copy of string.c] Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
28 lines
582 B
Makefile
28 lines
582 B
Makefile
# SPDX-License-Identifier: GPL-2.0
|
|
# The loops are all 64-bit code
|
|
CFLAGS += -I$(CURDIR)
|
|
|
|
EXTRA_SOURCES := ../harness.c
|
|
|
|
build_32bit = $(shell if ($(CC) $(CFLAGS) -m32 -o /dev/null memcmp.c >/dev/null 2>&1) then echo "1"; fi)
|
|
|
|
TEST_GEN_PROGS := memcmp_64 strlen
|
|
|
|
$(OUTPUT)/memcmp_64: memcmp.c
|
|
$(OUTPUT)/memcmp_64: CFLAGS += -m64 -maltivec
|
|
|
|
ifeq ($(build_32bit),1)
|
|
$(OUTPUT)/memcmp_32: memcmp.c
|
|
$(OUTPUT)/memcmp_32: CFLAGS += -m32
|
|
|
|
TEST_GEN_PROGS += memcmp_32
|
|
endif
|
|
|
|
$(OUTPUT)/strlen: strlen.c string.c
|
|
|
|
ASFLAGS = $(CFLAGS)
|
|
|
|
include ../../lib.mk
|
|
|
|
$(TEST_GEN_PROGS): $(EXTRA_SOURCES)
|