@@ -192,6 +192,29 @@ $(INSTALL_TARGETS): $(INSTALL_DIR) $(DESTDIR)/$(bindir)
## Install
install: $(INSTALL_TARGETS)
+## Test
+define _test
+ @set -e; $(top_srcdir)/lib/newlib_tests/runtest.sh -b $(abs_builddir) $(1)
+endef
+
+test: lib-all
+ifneq ($(build),$(host))
+ $(error running tests on cross-compile build not supported)
+endif
+ $(call _test)
+
+test-c: lib-all
+ifneq ($(build),$(host))
+ $(error running tests on cross-compile build not supported)
+endif
+ $(call _test,-c)
+
+test-shell: lib-all
+ifneq ($(build),$(host))
+ $(error running tests on cross-compile build not supported)
+endif
+ $(call _test,-s)
+
## Help
.PHONY: help
help: