-# Copyright (C) 1991-2019 Free Software Foundation, Inc.
+# Copyright (C) 1991-2023 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
# The GNU C Library is free software; you can redistribute it and/or
subdir_objs subdir_stubs subdir_testclean \
$(addprefix install-, no-libc.a bin lib data headers others)
\f
-headers := limits.h values.h features.h gnu-versions.h \
+headers := limits.h values.h features.h features-time64.h gnu-versions.h \
bits/xopen_lim.h gnu/libc-version.h stdc-predef.h \
bits/libc-header-start.h
# Ignore the error if we cannot update /etc/ld.so.cache.
ifeq (no,$(cross-compiling))
ifeq (yes,$(build-shared))
-install: install-symbolic-link
-.PHONY: install-symbolic-link
-install-symbolic-link: subdir_install
- $(symbolic-link-prog) $(symbolic-link-list)
- rm -f $(symbolic-link-list)
-
install:
-test ! -x $(elf-objpfx)ldconfig || LC_ALL=C \
$(elf-objpfx)ldconfig $(addprefix -r ,$(install_root)) \
GCONV_PATH="$${builddir}/iconvdata"
usage () {
- echo "usage: $$0 [--tool=strace] PROGRAM [ARGUMENTS...]" 2>&1
- echo " $$0 --tool=valgrind PROGRAM [ARGUMENTS...]" 2>&1
+cat << EOF
+Usage: $$0 [OPTIONS] <program> [ARGUMENTS...]
+
+ --tool=TOOL Run with the specified TOOL. It can be strace, rpctrace,
+ valgrind or container. The container will run within
+ support/test-container. For strace and valgrind,
+ additional arguments can be passed after the tool name.
+EOF
+
exit 1
}
exec $(subst $(common-objdir),"$${builddir}", $(test-program-prefix)) \
$${1+"$$@"}
;;
- strace)
- exec strace $(patsubst %, -E%, $(run-program-env)) \
+ strace*)
+ exec $$toolname $(patsubst %, -E%, $(run-program-env)) \
$(test-via-rtld-prefix) $${1+"$$@"}
;;
- valgrind)
- exec env $(run-program-env) valgrind $(test-via-rtld-prefix) $${1+"$$@"}
+ rpctrace)
+ exec rpctrace $(patsubst %, -E%, $(run-program-env)) \
+ $(test-via-rtld-prefix) $${1+"$$@"}
+ ;;
+ valgrind*)
+ exec env $(run-program-env) $$toolname $(test-via-rtld-prefix) $${1+"$$@"}
+ ;;
+ container)
+ exec env $(run-program-env) $(test-via-rtld-prefix) \
+ $(common-objdir)/support/test-container \
+ env $(run-program-env) $(test-via-rtld-prefix) $${1+"$$@"}
;;
*)
usage
SOURCE_DIR="$(CURDIR)"
BUILD_DIR="$(common-objpfx)"
CMD_FILE="$(common-objpfx)debugglibc.gdb"
+CONTAINER=false
DIRECT=true
+STATIC=false
SYMBOLSFILE=true
unset TESTCASE
unset BREAKPOINTS
The following options do not take arguments:
+ -c, --in-container
+ Run the test case inside a container and automatically attach
+ GDB to it.
-i, --no-direct
Selects whether to pass the --direct flag to the program.
--direct is useful when debugging glibc test cases. It inhibits the
ENVVARS="$$2 $$ENVVARS"
shift
;;
+ -c|--in-container)
+ CONTAINER=true
+ ;;
-i|--no-direct)
DIRECT=false
;;
shift
done
-# Check for required argument
-if [ ! -v TESTCASE ]
+# Check for required argument and if the testcase exists
+if [ ! -v TESTCASE ] || [ ! -f $${TESTCASE} ]
then
usage
exit 1
fi
+# Container tests needing locale data should install them in-container.
+# Other tests/binaries need to use locale data from the build tree.
+if [ "$$CONTAINER" = false ]
+then
+ ENVVARS="GCONV_PATH=$${BUILD_DIR}/iconvdata $$ENVVARS"
+ ENVVARS="LOCPATH=$${BUILD_DIR}/localedata $$ENVVARS"
+ ENVVARS="LC_ALL=C $$ENVVARS"
+fi
+
# Expand environment setup command
if [ -v ENVVARS ]
then
DIRECT=""
fi
+# Check if the test case is static
+if file $${TESTCASE} | grep "statically linked" >/dev/null
+then
+ STATIC=true
+else
+ STATIC=false
+fi
+
# Expand symbols loading command
if [ "$$SYMBOLSFILE" == true ]
then
echo "Env vars : $$ENVVARS"
echo
+if [ "$$CONTAINER" == true ]
+then
+# Use testrun.sh to start the test case with WAIT_FOR_DEBUGGER=1, then
+# automatically attach GDB to it.
+WAIT_FOR_DEBUGGER=1 $(common-objpfx)testrun.sh --tool=container $${TESTCASE} &
+gdb -x $${TESTCASE}.gdb
+elif [ "$$STATIC" == true ]
+then
+gdb $${TESTCASE}
+else
# Start the test case debugging in two steps:
# 1. the following command invokes gdb to run the loader;
# 2. the commands file tells the loader to run the test case.
-x $${CMD_FILE} \
-d $${SOURCE_DIR} \
$${BUILD_DIR}/elf/ld.so
+fi
endef
# This is another handy script for debugging dynamically linked program
endif # $(headers)
define summarize-tests
-@egrep -v '^(PASS|XFAIL):' $(objpfx)$1 || true
+@grep -E -v '^(PASS|XFAIL):' $(objpfx)$1 || true
@echo "Summary of test results$2:"
@sed 's/:.*//' < $(objpfx)$1 | sort | uniq -c
-@! egrep -q -v '^(X?PASS|XFAIL|UNSUPPORTED):' $(objpfx)$1
+@! grep -E -q -v '^(X?PASS|XFAIL|UNSUPPORTED):' $(objpfx)$1
endef
# The intention here is to do ONE install of our build into the
# We need a working /bin/sh for some of the tests.
test -d $(objpfx)testroot.pristine/bin || \
mkdir $(objpfx)testroot.pristine/bin
+ # We need the compiled locale dir for localedef tests.
+ test -d $(objpfx)testroot.pristine/$(complocaledir) || \
+ mkdir -p $(objpfx)testroot.pristine/$(complocaledir)
cp $(objpfx)support/shell-container $(objpfx)testroot.pristine/bin/sh
cp $(objpfx)support/echo-container $(objpfx)testroot.pristine/bin/echo
cp $(objpfx)support/true-container $(objpfx)testroot.pristine/bin/true
generated := $(generated) stubs.h
-files-for-dist := README INSTALL configure ChangeLog NEWS
+files-for-dist := README INSTALL configure NEWS
# Regenerate stuff, then error if these things are not committed yet.
dist-prepare: $(files-for-dist)
.PHONY: test
test :
@-rm -f $(objpfx)$t.out
- $(MAKE) subdir=$(dir $t) -C $(dir $t) ..=../ $(objpfx)$t.out
+ $(MAKE) subdir=$(patsubst %/,%,$(dir $t)) -C $(dir $t) ..=../ $(objpfx)$t.out
@cat $(objpfx)$t.test-result
@cat $(objpfx)$t.out