提交 c2692f3a 作者: Juan Batiz-Benet

Merge pull request #206 from chriscool/sharness3

Use Sharness as our shell test framework, version 3
# Run tests
#
# Copyright (c) 2014 Christian Couder
# MIT Licensed; see the LICENSE file in this repository.
#
T = $(sort $(wildcard t[0-9][0-9][0-9][0-9]-*.sh))
all: clean $(T) aggregate
clean:
-rm -r test-results
$(T):
@echo "*** $@ ***"; ./$@
aggregate:
./test-aggregate-results.sh
.PHONY: all clean $(T) aggregate
#!/bin/sh
#
# Copyright (c) 2014 Christian Couder
# MIT Licensed; see the LICENSE file in this repository.
#
test_description="Test installation and some basic commands"
. ./test-lib.sh
test_expect_success "current dir is writable" '
echo "It works!" >test.txt
'
test_expect_success "ipfs version succeeds" '
ipfs version >version.txt
'
test_expect_success "ipfs version output looks good" '
cat version.txt | egrep "^ipfs version [0-9]+\.[0-9]+\.[0-9]"
'
test_expect_success "ipfs help succeeds" '
ipfs help >help.txt
'
test_expect_success "ipfs help output looks good" '
cat help.txt | egrep "^Usage: +ipfs"
'
test_done
#!/bin/sh
#
# Script to aggregate results using Sharness
#
# Copyright (c) 2014 Christian Couder
# MIT Licensed; see the LICENSE file in this repository.
#
. ./test-sharness-config.sh
SHARNESS_AGGREGATE="$SHARNESS_DIRECTORY/aggregate-results.sh"
test -f "$SHARNESS_AGGREGATE" || {
echo >&2 "Cannot find: $SHARNESS_AGGREGATE"
echo >&2 "Please check Sharness installation."
exit 1
}
ls test-results/t*-*.sh.*.counts | "$SHARNESS_AGGREGATE"
# Test framework for go-ipfs
#
# Copyright (c) 2014 Christian Couder
# MIT Licensed; see the LICENSE file in this repository.
#
# We are using sharness (https://github.com/mlafeldt/sharness)
# which was extracted from the Git test framework.
. ./test-sharness-config.sh
. "$SHARNESS_LIB" || {
echo >&2 "Cannot source: $SHARNESS_LIB"
echo >&2 "Please check Sharness installation."
exit 1
}
# Please put go-ipfs specific shell functions below
# Copyright (c) 2014 Christian Couder
# MIT Licensed; see the LICENSE file in this repository.
#
# We are using sharness (https://github.com/mlafeldt/sharness)
# which was extracted from the Git test framework.
# You need either sharness to be installed system-wide or
# to set the SHARNESS_DIRECTORY environment variable properly.
if test -z "$SHARNESS_DIRECTORY"
then
SHARNESS_DIRECTORY=/usr/local/share/sharness
fi
SHARNESS_LIB="$SHARNESS_DIRECTORY/sharness.sh"
test -f "$SHARNESS_LIB" || {
echo >&2 "Cannot find sharness.sh in: $SHARNESS_DIRECTORY"
echo >&2 "Please install Sharness system-wide or set the"
echo >&2 "SHARNESS_DIRECTORY environment variable."
echo >&2 "See: https://github.com/mlafeldt/sharness"
exit 1
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论