Newer
Older
# Binaries that should generate the same output every time
error \
fcntl/create \
fcntl/fcntl \
fnmatch \
netdb/getaddrinfo \
signal \
stdio/printf \
stdio/rename \
stdio/scanf \
stdio/ungetc_ftell \
stdio/printf_neg_pad \
stdlib/env \
stdlib/mkostemps \
stdlib/rand \
stdlib/strtod \
stdlib/strtol \
stdlib/strtoul \
stdlib/system \
string/mem \
string/strchr \
string/strcpy \
string/strcspn \
string/strncmp \
string/strpbrk \
string/strrchr \
string/strspn \
string/strstr \
string/strtok \
string/strtok_r \
time/mktime \
time/strftime \
time/time \
unistd/access \
unistd/brk \
unistd/dup \
unistd/exec \
unistd/fchdir \
unistd/pipe \
unistd/rmdir \
unistd/sleep \
wchar/wcsstr \
wchar/wcscasecmp \
wchar/wcsncasecmp \
# Binaries that may generate varied output
time/gettimeofday \
unistd/chdir \
unistd/getcwd \
unistd/gethostname \
unistd/getid \
# resource/getrusage
# time/times
#TODO: dynamic tests currently broken
#BINS+=$(patsubst %,bins_dynamic/%,$(NAMES))
#BINS+=$(patsubst %,bins_dynamic/%,$(DYNAMIC_ONLY_NAMES))
EXPECT_BINS=$(patsubst %,bins_static/%,$(EXPECT_NAMES))
#EXPECT_BINS+=$(patsubst %,bins_dynamic/%,$(EXPECT_NAMES))
#EXPECT_BINS+=$(patsubst %,bins_dynamic/%,$(DYNAMIC_ONLY_NAMES))
.PHONY: all clean run expected verify
echo "# $${bin} #"; \
"$${bin}" test args || exit $$?; \
expected: | $(EXPECT_BINS)
echo "# $${bin} #"; \
mkdir -p expected/`dirname $${bin}`; \
"$${bin}" test args > "expected/$${bin}.stdout" 2> "expected/$${bin}.stderr" || exit $$?; \
bins_verify/relibc-tests: src/main.rs
$(CARGO_TEST) build --release --bin relibc-tests --out-dir bins_verify -Z unstable-options
verify: bins_verify/relibc-tests | $(EXPECT_BINS)
$(TEST_RUNNER) $< $(EXPECT_BINS)
-std=c11 \
-fno-builtin \
-fno-stack-protector \
-Wall \
-pedantic \
DYNAMIC_FLAGS=\
-Wl,--enable-new-dtags \
-Wl,-export-dynamic
../sysroot:
$(MAKE) -C .. sysroot
NATIVE_RELIBC?=0
ifeq ($(NATIVE_RELIBC),0)
-nostdinc \
-nostdlib \
-isystem ../sysroot/include \
../sysroot/lib/crt0.o \
STATIC_FLAGS+=\
$(SYSROOT_LIB)/libc.a
DYNAMIC_FLAGS+=\
mkdir -p "$$(dirname "$@")"
$(CC) "$<" -o "$@" $(FLAGS) $(STATIC_FLAGS)
bins_dynamic/%.so: %.c $(DEPS)
mkdir -p "$$(dirname "$@")"
$(CC) "$<" -o "$@" -shared -fpic $(FLAGS) $(DYNAMIC_FLAGS)
bins_dynamic/dlfcn: dlfcn.c bins_dynamic/sharedlib.so $(DEPS)
mkdir -p "$$(dirname "$@")"
$(CC) "$<" -o "$@" $(FLAGS) $(DYNAMIC_FLAGS)