From af914c5193a63a2fc5af1f6235bdb2c29e3b1658 Mon Sep 17 00:00:00 2001 From: Jeromy Date: Thu, 1 Sep 2016 18:55:36 -0700 Subject: [PATCH] add better test to be more sure that file descriptor limits were actually raised License: MIT Signed-off-by: Jeromy --- package.json | 6 ++++++ test/Makefile | 8 ++++++++ test/sharness/Makefile | 2 +- test/sharness/t0060-daemon.sh | 22 +++++++--------------- 4 files changed, 22 insertions(+), 16 deletions(-) diff --git a/package.json b/package.json index bc6cdc040cf..013ce59d151 100644 --- a/package.json +++ b/package.json @@ -189,6 +189,12 @@ "hash": "QmVvJ27GcLaLSXvcB4auk3Gn3xuWK5ti5ENkZ2pCoJEYW4", "name": "autobatch", "version": "0.2.0" + }, + { + "author": "whyrusleeping", + "hash": "QmdCL8M8DXJdSRnwhpDhukX5r8ydjxnzPJpaKrFudDA8yn", + "name": "hang-fds", + "version": "0.0.0" } ], "gxVersion": "0.4.0", diff --git a/test/Makefile b/test/Makefile index 4d824a88ed9..f6d53dbdd3a 100644 --- a/test/Makefile +++ b/test/Makefile @@ -60,10 +60,18 @@ multihash_src: $(eval MULTIHASH_HASH := $(shell cd .. && bin/gx deps find go-multihash)) $(eval MULTIHASH_SRC := gx/ipfs/$(MULTIHASH_HASH)/go-multihash) +hang-fds_src: + $(eval HANG_FDS_HASH := $(shell cd .. && bin/gx deps find hang-fds)) + $(eval HANG_FDS_SRC := gx/ipfs/$(HANG_FDS_HASH)/hang-fds) + bin/multihash: multihash_src $(call find_go_files, $(MULTIHASH_SRC)) IPFS-BUILD-OPTIONS @echo "*** installing $@ ***" go build $(GOFLAGS) -o bin/multihash $(MULTIHASH_SRC)/multihash +bin/hang-fds: hang-fds_src $(call find_go_files, $(HANG_FDS_SRC)) IPFS-BUILD-OPTIONS + @echo "*** installing $@ ***" + go build $(GOFLAGS) -o bin/hang-fds $(HANG_FDS_SRC) + iptb_src: $(eval IPTB_HASH := $(shell cd .. && bin/gx deps find iptb)) $(eval IPTB_SRC := gx/ipfs/$(IPTB_HASH)/iptb) diff --git a/test/sharness/Makefile b/test/sharness/Makefile index 2c5488dcbc0..9b50ec7a22b 100644 --- a/test/sharness/Makefile +++ b/test/sharness/Makefile @@ -8,7 +8,7 @@ T = $(sort $(wildcard t[0-9][0-9][0-9][0-9]-*.sh)) BINS = bin/random bin/multihash bin/ipfs bin/pollEndpoint \ - bin/iptb bin/go-sleep bin/random-files bin/go-timeout + bin/iptb bin/go-sleep bin/random-files bin/go-timeout bin/hang-fds SHARNESS = lib/sharness/sharness.sh IPFS_ROOT = ../.. diff --git a/test/sharness/t0060-daemon.sh b/test/sharness/t0060-daemon.sh index 023ab9a9b61..beae67eb53d 100755 --- a/test/sharness/t0060-daemon.sh +++ b/test/sharness/t0060-daemon.sh @@ -129,21 +129,13 @@ test_expect_success "daemon raised its fd limit" ' grep "raised file descriptor limit to 1024." actual_daemon > /dev/null ' -get_col_four() { - awk '{ print $4 }' $1 -} - -if [ `uname` == "Linux" ]; then - test_expect_success "get fd limit through /proc" ' - cat /proc/$IPFS_PID/limits > limits && - grep "Max open files" limits > fd_limits_line && - limit=$(get_col_four fd_limits_line) - ' - - test_expect_success "limit from system looks good" ' - test "$limit" -eq 1024 - ' -fi +test_expect_success "daemon actually can handle 1024 file descriptors" ' + hang-fds -hold=2s 1000 '$API_MADDR' +' + +test_expect_success "daemon didnt throw any errors" ' + test_expect_code 1 grep "too many open files" daemon_err +' test_kill_ipfs_daemon