From: Ian Jackson Date: Sun, 22 Aug 2021 21:48:09 +0000 (+0100) Subject: log capturing X-Git-Tag: hippotat/1.0.0~83 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ian/git?a=commitdiff_plain;h=13ac3766b699225f0ca040f4be6dc5914d9da186;p=hippotat.git log capturing Signed-off-by: Ian Jackson --- diff --git a/Makefile b/Makefile index 0cf5f10..7a4a7b2 100644 --- a/Makefile +++ b/Makefile @@ -11,8 +11,6 @@ TARGET_DIR ?= target SPHINXBUILD ?= sphinx-build -CFLAGS += -Wall - ifneq (,$(wildcard ../Cargo.nail)) NAILING_CARGO ?= nailing-cargo @@ -29,16 +27,25 @@ rsrcs = $(shell $(foreach x,$(MAKEFILE_FIND_X),set -$x;)\ find -H $1 \( -name Cargo.toml -o -name Cargo.lock -o -name Cargo.lock.example -o -name \*.rs \) ) stamp=@mkdir -p stamp; touch $@ +TESTS=$(notdir $(wildcard test/t-*[^~])) + all: cargo-build doc -check: all rndaddtoentcnt-build +check: cargo-test $(addprefix stamp/,$(TESTS)) cargo-build: stamp/cargo-build +cargo-test: # stamp/cargo-test xxx -stamp/cargo-build: $(call rsrcs,.) - $(NAILING_CARGO) build $(CARGO_BUILD_OPTIONS) +stamp/cargo-%: $(call rsrcs,.) + $(NAILING_CARGO) $* $(CARGO_BUILD_OPTIONS) $(stamp) +stamp/t-%: test/t-% stamp/cargo-build $(wildcard test/*[^~]) + $(NAILING_CARGO_JUST_RUN) \ + $(abspath test/capture-log) tmp/t-$*.log \ + $(abspath test/go-with-unshare test/t-$*) + @echo OK t-$*; touch $@ + doc: docs/html/index.html @echo 'Documentation can now be found here:' @echo ' file://$(PWD)/$<' @@ -46,10 +53,8 @@ doc: docs/html/index.html docs/html/index.html: docs/conf.py $(wildcard docs/*.md docs/*.rst docs/*.png) $(SPHINXBUILD) -M html docs docs $(SPHINXOPTS) -rndaddtoentcnt-build: uml/rndaddtoentcnt/rndaddtoentcnt - clean: rm -rf stamp/* doc/html $(NAILING_CARGO) clean -.PHONY: cargo-build rndaddtoentcnt-build all doc clean +.PHONY: cargo-build all doc clean diff --git a/test/capture-log b/test/capture-log new file mode 100755 index 0000000..ff13c6b --- /dev/null +++ b/test/capture-log @@ -0,0 +1,9 @@ +#!/bin/bash +# Copyright 2020-2021 Ian Jackson and contributors to Otter +# SPDX-License-Identifier: GPL-3.0-or-later +# There is NO WARRANTY. +set -e + +log="$1"; shift +mkdir -p tmp +"$@" 2>&1 | ts >"$log" diff --git a/test/t-basic b/test/t-basic index b1c145e..039a3cd 100755 --- a/test/t-basic +++ b/test/t-basic @@ -10,5 +10,5 @@ test-prep start-server start-client -in-ns client ping -c 10 192.0.2.1 >$tmp/ping +in-ns client ping -i 0.1 -c 10 192.0.2.1 >$tmp/ping grep ' 0% packet loss' $tmp/ping