(please answer to the mailing-list)
The test binary is built in a temporary directory, but it is run from
the source directory, so it has easy access to the testdata/
subdirectory. Look at the source code of the compress/gzip package for
examples.
Rémy
2012/9/24, Alessandro <
dedal...@gmail.com>:
>
> From: Rémy Oudompheng <
remyoud...@gmail.com>
>
>> go test runs the binary in the sources dirctory. The usual pattern is
>
>
>
http://golang.org/cmd/go/ : " The package is built in a temporary
> directory so it does not interfere with the non-test installation"
>
>
>> to have your data files in a testdata/ subdirectory, and access them
>> via a relative path. Search the standard library for examples.
>
> I'm searching, but I'm not lucky.
> I found something about the " -test.X flags", but..
>
> go test -x -v -cpuprofile=prof.out -dir=testdata -update
>
> will compile the test binary and then run it as
>
> pkg.test -test.v -test.cpuprofile=prof.out -dir=testdata -update
>
>
> So "-dir" is a flag that has to be managed by my run_main.go.
> And how can I manage it? Have I attach "testdir" to Getwd()? I don't
> want it.
>
>
> Can you please link me an example?
>