Skip to content

Commit

Permalink
integration-tests: support out-of-tree tests
Browse files Browse the repository at this point in the history
`go test` requires both config.go and the test files in the same
directory. For out-of-tree builds, config.go is normally not placed next
to the source files, so copy the tests to the build directory as a
workaround.
  • Loading branch information
Lekensteyn committed Feb 13, 2016
1 parent a6effb4 commit 2593036
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
8 changes: 6 additions & 2 deletions integration-tests/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,14 @@
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

EXTRA_DIST = \
GO_FILES = \
nghttpx_http1_test.go \
nghttpx_http2_test.go \
nghttpx_spdy_test.go \
server_tester.go \
server_tester.go

EXTRA_DIST = \
$(GO_FILES) \
server.key \
server.crt \
alt-server.key \
Expand All @@ -43,4 +46,5 @@ itprep-local:
go get -d -v golang.org/x/net/websocket

it-local:
for i in $(GO_FILES); do [ -e $(builddir)/$$i ] || cp $(srcdir)/$$i $(builddir); done
sh setenv go test -v
1 change: 1 addition & 0 deletions integration-tests/config.go.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ package nghttp2

const (
buildDir = "@top_builddir@"
sourceDir = "@top_srcdir@"
)
5 changes: 3 additions & 2 deletions integration-tests/server_tester.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ import (
const (
serverBin = buildDir + "/src/nghttpx"
serverPort = 3009
testDir = buildDir + "/integration-tests"
testDir = sourceDir + "/integration-tests"
logDir = buildDir + "/integration-tests"
)

func pair(name, value string) hpack.HeaderField {
Expand Down Expand Up @@ -124,7 +125,7 @@ func newServerTesterInternal(args []string, t *testing.T, handler http.Handler,
// "127.0.0.1,8080"
b := "-b" + strings.Replace(backendURL.Host, ":", ",", -1)
args = append(args, fmt.Sprintf("-f127.0.0.1,%v", serverPort), b,
"--errorlog-file="+testDir+"/log.txt", "-LINFO")
"--errorlog-file="+logDir+"/log.txt", "-LINFO")

authority := fmt.Sprintf("127.0.0.1:%v", serverPort)

Expand Down

0 comments on commit 2593036

Please sign in to comment.