Commit 0b199dd4 authored by Juan Batiz-Benet's avatar Juan Batiz-Benet

Merge pull request #511 from jbenet/test-reorg

test reorg
parents 83075727 fa337415
......@@ -35,10 +35,10 @@ test_go_expensive:
go test ./...
test_sharness_short:
cd test/ && make
cd test/sharness/ && make
test_sharness_expensive:
cd test/ && TEST_EXPENSIVE=1 make
cd test/sharness/ && TEST_EXPENSIVE=1 make
test_all_commits:
@echo "testing all commits between origin/master..HEAD"
......
# STRIP strips color from terminal output
STRIP="perl -pe 's/\e\[?.*?[\@-~]//g'"
# TODO use a for loop like a grownup
docker logs dockertest_bootstrap_1 2>&1 | eval $STRIP > ./build/bootstrap.log
docker logs dockertest_client_1 2>&1 | eval $STRIP > ./build/client.log
docker logs dockertest_data_1 2>&1 | eval $STRIP > ./build/data.log
docker logs dockertest_server_1 2>&1 | eval $STRIP > ./build/server.log
#!/bin/sh
export GOPATH=$WORKSPACE
PWD=`pwd`
cd ../3nodetest
make clean
make test
make save_logs
docker cp dockertest_server_1:/root/.go-ipfs/logs/events.log $(PWD)/build/server-events.log
docker cp dockertest_bootstrap_1:/root/.go-ipfs/logs/events.log $(PWD)/build/bootstrap-events.log
docker cp dockertest_client_1:/root/.go-ipfs/logs/events.log $(PWD)/build/client-events.log
lib/sharness/
bin/ipfs
bin/random
test-results/
trash directory.*.sh/
RANDOMSRC = Godeps/_workspace/src/github.com/jbenet/go-random/random
RANDOMSRC = ../../Godeps/_workspace/src/github.com/jbenet/go-random
IMAGE_NAME = ipfs-test-latest
IPFS_ROOT = ../..
test: clean setup
./run-test-on-img.sh $(IMAGE_NAME)
......@@ -15,13 +16,13 @@ data/filetiny: Makefile
data/filerand: bin/random
./bin/random 50000000 > ./data/filerand
bin/random:
go build -o ./bin/random ../$(RANDOMSRC)
bin/random: $(RANDOMSRC)/**/*.go
go build -o ./bin/random $(RANDOMSRC)/random
# just build it every time... this part isn't
# even the lengthy part, and it decreases pain.
docker_ipfs_image:
cd .. && docker build -t $(IMAGE_NAME) .
cd $(IPFS_ROOT) && docker build -t $(IMAGE_NAME) .
docker images | grep $(IMAGE_NAME)
clean:
......
# STRIP strips color from terminal output
STRIP="perl -pe 's/\e\[?.*?[\@-~]//g'"
# TODO use a for loop like a grownup
docker logs 3nodetest_bootstrap_1 2>&1 | eval $STRIP > ./build/bootstrap.log
docker logs 3nodetest_client_1 2>&1 | eval $STRIP > ./build/client.log
docker logs 3nodetest_data_1 2>&1 | eval $STRIP > ./build/data.log
docker logs 3nodetest_server_1 2>&1 | eval $STRIP > ./build/server.log
ipfs bootstrap add /ip4/$BOOTSTRAP_PORT_4011_TCP_ADDR/tcp/$BOOTSTRAP_PORT_4011_TCP_PORT/QmNXuBh8HFsWq68Fid8dMbGNQTh7eG6hV9rr1fQyfmfomE
echo "dockertest> starting client daemon"
echo "3nodetest> starting client daemon"
ipfs daemon &
sleep 3
while [ ! -f /data/idtiny ]
do
echo "dockertest> waiting for server to add the file..."
echo "3nodetest> waiting for server to add the file..."
sleep 1
done
echo "dockertest> client found file with hash:" $(cat /data/idtiny)
echo "3nodetest> client found file with hash:" $(cat /data/idtiny)
ipfs cat $(cat /data/idtiny) > filetiny
......@@ -25,10 +25,10 @@ fi
while [ ! -f /data/idrand ]
do
echo "dockertest> waiting for server to add the file..."
echo "3nodetest> waiting for server to add the file..."
sleep 1
done
echo "dockertest> client found file with hash:" $(cat /data/idrand)
echo "3nodetest> client found file with hash:" $(cat /data/idrand)
cat /data/idrand
......@@ -46,4 +46,4 @@ if (($? > 0)); then
exit 1
fi
echo "dockertest> success"
echo "3nodetest> success"
......@@ -3,7 +3,7 @@ ipfs bootstrap add /ip4/$BOOTSTRAP_PORT_4011_TCP_ADDR/tcp/$BOOTSTRAP_PORT_4011_T
# wait for daemon to start/bootstrap
# alternatively use ipfs swarm connect
echo "dockertest> starting server daemon"
echo "3nodetest> starting server daemon"
ipfs daemon &
sleep 3
# TODO instead of bootrapping: ipfs swarm connect /ip4/$BOOTSTRAP_PORT_4011_TCP_ADDR/tcp/$BOOTSTRAP_PORT_4011_TCP_PORT/QmNXuBh8HFsWq68Fid8dMbGNQTh7eG6hV9rr1fQyfmfomE
......@@ -11,11 +11,11 @@ sleep 3
# must mount this volume from data container
ipfs add -q /data/filetiny > tmptiny
mv tmptiny /data/idtiny
echo "dockertest> added tiny file. hash is" $(cat /data/idtiny)
echo "3nodetest> added tiny file. hash is" $(cat /data/idtiny)
ipfs add -q /data/filerand > tmprand
mv tmprand /data/idrand
echo "dockertest> added rand file. hash is" $(cat /data/idrand)
echo "3nodetest> added rand file. hash is" $(cat /data/idrand)
# allow ample time for the client to pull the data
sleep 10000000
# Run tests
#
# Copyright (c) 2014 Christian Couder
# MIT Licensed; see the LICENSE file in this repository.
#
# NOTE: run with TEST_VERBOSE=1 for verbose sharness tests.
BINS = bin/random bin/ipfs
IPFS_ROOT = ../
IPFS_CMD = ../cmd/ipfs
RANDOM_SRC = ../Godeps/_workspace/src/github.com/jbenet/go-random
T = $(sort $(wildcard t[0-9][0-9][0-9][0-9]-*.sh))
SHARNESS = lib/sharness/sharness.sh
RANDOMSRC = Godeps/_workspace/src/github.com/jbenet/go-random/random
all: deps
all: clean deps $(T) aggregate
deps: bins
clean:
@echo "*** $@ ***"
-rm -rf test-results
rm $(BINS)
$(T):
@echo "*** $@ ***"
./$@
bins: $(BINS)
aggregate:
@echo "*** $@ ***"
lib/test-aggregate-results.sh
bin/random: $(RANDOM_SRC)/**/*.go
go build -o bin/random $(RANDOM_SRC)/random
deps: $(SHARNESS) ipfs random
bin/ipfs: $(IPFS_ROOT)/**/*.go
go build -o bin/ipfs $(IPFS_CMD)
$(SHARNESS):
@echo "*** installing $@ ***"
lib/install-sharness.sh
test: test_expensive
# phony to ensure we re-build it every time we run tests
ipfs:
@echo "*** installing $@ ***"
mkdir -p bin
cd ../cmd/ipfs && go build
cp ../cmd/ipfs/ipfs bin/ipfs
test_expensive:
cd sharness && make TEST_EXPENSIVE=1
cd 3nodetest && make
random:
@echo "*** installing $@ ***"
mkdir -p bin
go build -o bin/random ../$(RANDOMSRC)
test_cheap:
cd sharness && make
cd 3nodetest && make
.PHONY: all clean $(T) aggregate ipfs random
.PHONY: all clean
# This Makefile provides a way to really simple way to run benchmarks in a
# docker environment.
IPFS_ROOT = ../..
IMAGE = jbenet/go-ipfs-bench
CONTAINER = go-ipfs-bench
PACKAGE = epictest
PACKAGE_DIR = epictest
PACKAGE_DIR = test/epictest
BUILD_DIR = ./build/bench
CONTAINER_WORKING_DIR = /go
CPU_PROF_NAME = cpu.out
......@@ -18,7 +19,7 @@ cp_pprof_from_container:
docker cp $(CONTAINER):$(CONTAINER_WORKING_DIR)/$(PACKAGE).test $(BUILD_DIR)
build_image:
cd .. && docker build -t $(IMAGE) .
cd $(IPFS_ROOT) && docker build -t $(IMAGE) .
run_profiler:
docker run --name $(CONTAINER) -it --entrypoint go $(IMAGE) test ./src/github.com/jbenet/go-ipfs/$(PACKAGE_DIR) --cpuprofile=$(CPU_PROF_NAME)
......
#!/bin/sh
export GOPATH=$WORKSPACE
PWD=`pwd`
cd ../3nodetest
make clean
make test
make save_logs
docker cp 3nodetest_server_1:/root/.go-ipfs/logs/events.log $(PWD)/build/server-events.log
docker cp 3nodetest_bootstrap_1:/root/.go-ipfs/logs/events.log $(PWD)/build/bootstrap-events.log
docker cp 3nodetest_client_1:/root/.go-ipfs/logs/events.log $(PWD)/build/client-events.log
lib/sharness/
test-results/
trash directory.*.sh/
# Run tests
#
# Copyright (c) 2014 Christian Couder
# MIT Licensed; see the LICENSE file in this repository.
#
# NOTE: run with TEST_VERBOSE=1 for verbose sharness tests.
T = $(sort $(wildcard t[0-9][0-9][0-9][0-9]-*.sh))
BINS = bin/random bin/ipfs
SHARNESS = lib/sharness/sharness.sh
all: clean deps $(T) aggregate
clean:
@echo "*** $@ ***"
-rm -rf test-results
$(T):
@echo "*** $@ ***"
./$@
aggregate:
@echo "*** $@ ***"
lib/test-aggregate-results.sh
deps: $(SHARNESS) $(BINS)
$(SHARNESS):
@echo "*** installing $@ ***"
lib/install-sharness.sh
bin/%:
@echo "*** installing $@ ***"
cd .. && make $@
.PHONY: all clean $(T) aggregate
../bin
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment