1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-29 12:07:46 +00:00

add back busybox test support

This commit is contained in:
Nathan Ross 2015-12-20 19:48:26 -05:00
parent dffdca0406
commit a0d7910e91

View file

@ -24,6 +24,10 @@ BASEDIR ?= $(shell pwd)
BUILDDIR := $(BASEDIR)/target/${PROFILE}/
PKG_BUILDDIR := $(BUILDDIR)/deps/
BUSYBOX_ROOT := $(BASEDIR)/tmp/
BUSYBOX_VER := 1.24.1
BUSYBOX_SRC:=$(BUSYBOX_ROOT)/busybox-$(BUSYBOX_VER)/
# Possible programs
PROGS := \
base64 \
@ -160,6 +164,11 @@ TEST ?= $(TEST_PROGS)
TESTS := \
$(sort $(filter $(TEST),$(filter-out $(DONT_TEST),$(TEST_PROGS))))
BUSYTEST ?= $(PROGS)
BUSYTESTS := \
$(sort $(filter $(BUSYTEST),$(filter-out $(DONT_BUSYTEST),$(PROGS))))
define BUILD_EXE
build_exe_$(1):
${CARGO} build ${CARGOFLAGS} ${PROFILE_CMD} -p $(1)
@ -170,6 +179,11 @@ test_integration_$(1): build_exe_$(1)
${CARGO} test ${CARGOFLAGS} --test $(1) --features $(1) --no-default-features
endef
define TEST_BUSYBOX
test_busybox_$(1): build_exe_$(1)
(cd $(BUSYBOX_SRC)/testsuite && bindir=$(BUILDDIR) ./runtest $(RUNTEST_ARGS) $(1) )
endef
# Output names
EXES := \
$(sort $(filter $(BUILD),$(filter-out $(DONT_BUILD),$(PROGS))))
@ -210,9 +224,35 @@ build-uutils: $(addprefix build_exe_,$(EXES))
build: build-uutils
$(foreach test,$(TESTS),$(eval $(call TEST_INTEGRATION,$(test))))
$(foreach test,$(PROGS),$(eval $(call TEST_BUSYBOX,$(test))))
test: $(addprefix test_integration_,$(TESTS))
busybox-src:
if [ ! -e $(BUSYBOX_SRC) ]; then \
mkdir -p $(BUSYBOX_ROOT); \
wget http://busybox.net/downloads/busybox-$(BUSYBOX_VER).tar.bz2 -P $(BUSYBOX_ROOT); \
tar -C $(BUSYBOX_ROOT) -xf $(BUSYBOX_ROOT)/busybox-$(BUSYBOX_VER).tar.bz2; \
fi; \
ensure-builddir:
mkdir -p $(BUILDDIR)
# Test under the busybox testsuite
$(BUILDDIR)/busybox: busybox-src ensure-builddir
echo '#!/bin/bash\n$(PKG_BUILDDIR)./$$1 $${@:2}' > $@; \
chmod +x $@;
# This is a busybox-specific config file their test suite wants to parse.
$(BUILDDIR)/.config: $(BASEDIR)/.busybox-config ensure-builddir
cp $< $@
ifeq ($(BUSYTESTS),)
busytest:
else
busytest: $(BUILDDIR)/busybox $(BUILDDIR)/.config $(addprefix test_busybox_,$(BUSYTESTS))
endif
clean:
$(RM) -rf $(BUILDDIR)