summaryrefslogtreecommitdiff
path: root/misc/cgo/stdio
Commit message (Collapse)AuthorAgeFilesLines
* misc: remove use of relative directories in overlayDir functionsBryan C. Mills2019-11-251-7/+4
| | | | | | | | | | | | | | | | | | | | | | It turns out that the relative-path support never worked in the first place. It had been masked by the fact that we ~never invoke overlayDir with an absolute path, which caused filepath.Rel to always return an error, and overlayDir to always fall back to absolute paths. Since the absolute paths seem to be working fine (and are simpler), let's stick with those. As far as I can recall, the relative paths were only a space optimization anyway. Updates #28387 Updates #30316 Change-Id: Ie8cd28f3c41ca6497ace2799f4193d7f5dde7a37 Reviewed-on: https://go-review.googlesource.com/c/go/+/208481 Run-TryBot: Bryan C. Mills <bcmills@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Jay Conrod <jayconrod@google.com>
* misc: ensure that test overlay directories are writableBryan C. Mills2019-11-111-1/+1
| | | | | | | | | | | | | Otherwise, the test cannot create new files in the directory. Updates #32407 Updates #30316 Change-Id: Ief0df94a202be92f57d458d4ab4e4daa9ec189b1 Reviewed-on: https://go-review.googlesource.com/c/go/+/206458 Run-TryBot: Bryan C. Mills <bcmills@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
* misc/android: enable many more tests on GOOS=androidElias Naur2019-03-081-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Android tests are built on the host and run on the device. To do that, the exec wrapper copies the test binary and testdata to the device. To enable many more tests, make the copied environment more like the host: - Copy all of pkg from GOROOT, not just the android pkg directory. - Copy any parent testdata directories as well as the package's own. - Copy *.go files from the package directory. This enables misc/cgo/stdio and misc/cgo/life tests that were invisible before so disable them explicitly. - Always copy the GOROOT, even for tests outside GOROOT. This is expensive but only done once per make.bash. - Build the go tool for the device and put it in PATH. Set GOCACHE to a writable directory and disable cgo. While here, use a single directory for all the exec wrapper files and delete that once per make.bash as well. In total, this CL enables many tests in the subrepos that would need skips without it, in particular the x/tools tests. Fixes #11452 Updates #23824 Updates #11811 Change-Id: I2e50d8b57db9bc4637f25272a5360c8b2cf4e627 Reviewed-on: https://go-review.googlesource.com/c/go/+/165797 Reviewed-by: Bryan C. Mills <bcmills@google.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
* misc/cgo: skip cgotest.TestCrossPackageTests on iOS and set PWDBryan C. Mills2019-02-261-0/+1
| | | | | | | | | | | | | | | I hope that this will fix the tests on iOS, but 'gomote create' isn't giving me an instance I can test with. (Please patch and test before approving.) Updates #15919 Updates #30228 Change-Id: I1b7cd30d5b127a1ad3243b329fa005d229f69a24 Reviewed-on: https://go-review.googlesource.com/c/163726 Run-TryBot: Bryan C. Mills <bcmills@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Elias Naur <mail@eliasnaur.com>
* misc/cgo/stdio: fix tests in module modeBryan C. Mills2019-02-2411-3/+144
| | | | | | | | | | Updates #30228 Change-Id: I4d213c6fe68c47ccb877f13b55128e035f76a26b Reviewed-on: https://go-review.googlesource.com/c/163421 Run-TryBot: Bryan C. Mills <bcmills@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
* test: remove rundircmpout and cmpout actionsYury Smolsky2018-05-313-3/+3
| | | | | | | | | | | | | | This CL removes the rundircmpout action completely because it is not used anywhere. The run case already looks for output files. Rename the cmpout action mentioned in tests to the run action and remove "cmpout" from run.go. Change-Id: I835ceb70082927f8e9360e0ea0ba74f296363ab3 Reviewed-on: https://go-review.googlesource.com/115575 Run-TryBot: Yury Smolsky <yury@smolsky.by> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
* test/run: use go tool compile + link instead of go run when possibleRuss Cox2017-10-313-3/+3
| | | | | | | | | | | | | | | This cuts 6 seconds off all.bash with the new go command. Not a ton, but also an easy 6 seconds to grab. The -tags=use_go_run in the misc/cgo tests is just some go command flag that will make run.go use go run, but without making everything look stale. (Those tests have relative imports, so go tool compile+link is not enough.) Change-Id: I43bf4bb661d3adde2b2d4aad5e8f64b97bc69ba9 Reviewed-on: https://go-review.googlesource.com/73994 Reviewed-by: Ian Lance Taylor <iant@golang.org>
* all: make copyright headers consistent with one space after periodEmmanuel Odeke2016-05-025-5/+5
| | | | | | | | | | | | | | | | | | Follows suit with https://go-review.googlesource.com/#/c/20111. Generated by running $ grep -R 'Go Authors. All' * | cut -d":" -f1 | while read F;do perl -pi -e 's/Go Authors. All/Go Authors. All/g' $F;done The code in cmd/internal/unvendor wasn't changed. Fixes #15213 Change-Id: I4f235cee0a62ec435f9e8540a1ec08ae03b1a75f Reviewed-on: https://go-review.googlesource.com/21819 Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
* misc/cgo/stdio: reenable testsRuss Cox2015-12-053-5/+7
| | | | | | | | | | | | | The build tags are necessary to keep "go build" in that directory building only stdio.go, but we have to arrange for test/run.go to treat them as satisfied. Fixes #12625. Change-Id: Iec0cb2fdc2c9b24a4e0530be25e940aa0cc9552e Reviewed-on: https://go-review.googlesource.com/17454 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
* misc/cgo/stdio: make it work on Windows and also test itShenghou Ma2012-09-202-20/+11
| | | | | | | | | | | | | | use a function to get stdout and stderr, instead of depending on a specific libc implementation. also make test/run.go replace \r\n by \n before comparing output. Fixes #2121. Part of issue 1741. R=alex.brainman, rsc, r, remyoudompheng CC=golang-dev https://golang.org/cl/5847068
* misc/cgo/{life,stdio}, test/run.go: use test/run.go to do the cgo testsShenghou Ma2012-08-079-20/+155
| | | | | | | | | Enhances test/run.go to support testing other directories Will enable stdio tests on Windows in a follow-up CL. R=golang-dev, alex.brainman, rsc CC=golang-dev https://golang.org/cl/6220049
* cgo: enable cgo on netbsd/386 and netbsd/amd64Joel Sing2012-06-051-0/+16
| | | | | | R=golang-dev, rsc CC=golang-dev https://golang.org/cl/6261056
* misc/cgo/stdio: split stdout/stderr into a separate fileJoel Sing2012-06-052-3/+15
| | | | | | | | | | | Split stdout/stderr into a separate file so that can be handled differently on some platforms. Both NetBSD and OpenBSD have defines for stdout/stderr that require some coercion in order for cgo to handle them correctly. R=golang-dev, rsc CC=golang-dev https://golang.org/cl/6247062
* misc/cgo: re-enable some testsRuss Cox2012-03-066-23/+17
| | | | | | | | The testso directory still needs to be enabled. R=golang-dev, r CC=golang-dev https://golang.org/cl/5731048
* various: use $GCFLAGS and $GCIMPORTS like Make doesMaxim Pimenov2011-12-161-1/+1
| | | | | | R=golang-dev, rsc CC=golang-dev https://golang.org/cl/5489065
* use new strconv APIRuss Cox2011-12-051-1/+1
| | | | | | | | | | | | All but 3 cases (in gcimporter.go and hixie.go) are automatic conversions using gofix. No attempt is made to use the new Append functions even though there are definitely opportunities. R=golang-dev, gri CC=golang-dev https://golang.org/cl/5447069
* cgo: add GoBytes, fix gmp exampleRuss Cox2011-07-281-0/+1
| | | | | | | | | Fixes #1640. Fixes #2007. R=golang-dev, adg CC=golang-dev https://golang.org/cl/4815063
* runtime: scheduler, cgo reorganizationRuss Cox2011-03-075-273/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Change use of m->g0 stack (aka scheduler stack). * Provide runtime.mcall(f) to invoke f() on m->g0 stack. * Replace scheduler loop entry with runtime.mcall(schedule). Runtime.mcall eliminates the need for fake scheduler states that exist just to run a bit of code on the m->g0 stack (Grecovery, Gstackalloc). The elimination of the scheduler as a loop that stops and starts using gosave and gogo fixes a bad interaction with the way cgo uses the m->g0 stack. Cgo runs external (gcc-compiled) C functions on that stack, and then when calling back into Go, it sets m->g0->sched.sp below the added call frames, so that other uses of m->g0's stack will not interfere with those frames. Unfortunately, gogo (longjmp) back to the scheduler loop at this point would end up running scheduler with the lower sp, which no longer points at a valid stack frame for a call to scheduler. If scheduler then wrote any function call arguments or local variables to where it expected the stack frame to be, it would overwrite other data on the stack. I realized this possibility while debugging a problem with calling complex Go code in a Go -> C -> Go cgo callback. This wasn't the bug I was looking for, it turns out, but I believe it is a real bug nonetheless. Switching to runtime.mcall, which only adds new frames to the stack and never jumps into functions running in existing ones, fixes this bug. * Move cgo-related code out of proc.c into cgocall.c. * Add very large comment describing cgo call sequences. * Simpilify, regularize cgo function implementations and names. * Add test suite as misc/cgo/test. Now the Go -> C path calls cgocall, which calls asmcgocall, and the C -> Go path calls cgocallback, which calls cgocallbackg. The shuffling, which affects mainly the callback case, moves most of the callback implementation to cgocallback running on the m->curg stack (not the m->g0 scheduler stack) and only while accounted for with $GOMAXPROCS (between calls to exitsyscall and entersyscall). The previous callback code did not block in startcgocallback's approximation to exitsyscall, so if, say, the garbage collector were running, it would still barge in and start doing things like call malloc. Similarly endcgocallback's approximation of entersyscall did not call matchmg to kick off new OS threads when necessary, which caused the bug in issue 1560. Fixes #1560. R=iant CC=golang-dev https://golang.org/cl/4253054
* go/ast: reflect communication operator changes accurately in astRobert Griesemer2011-02-011-1/+1
| | | | | | | | | | | | | | | - go/ast: introduce SendStmt; adjust SelectStmt - go/parser: accept new communication syntax, minor unrelated cleanups - go/printer: adjustments for new ast, fewer binary expression precedences - go/token: remove one binary precedence Adjusted dependent code. gofmt -w src -misc. Ran all tests. R=rsc, gri CC=golang-dev https://golang.org/cl/3989056
* cgo: handle references to symbols in shared librariesRuss Cox2010-12-171-0/+4
| | | | | | | | Fixes #1334. R=r CC=golang-dev https://golang.org/cl/3746041
* cgo: do not reset tag generator between filesRuss Cox2010-12-133-1/+62
| | | | | | | | | | | | | Clean up an error message and error exit too. Insert blank line after "DO NOT EDIT" comment to keep it from being a doc comment. Fixes #1213. Fixes #1222. R=r CC=golang-dev https://golang.org/cl/3608042
* cgo: bug fixesRuss Cox2010-09-211-1/+23
| | | | | | | | | | * Add documentation about array arguments. Fixes issue 1125. * Do not interpret x, y := z, w as special errno form. Fixes issue 952. * Fix nested Go calls (brainman). Fixes issue 907. R=r CC=golang-dev https://golang.org/cl/2214044
* build: remove unnecessary references to GOBIN and GOROOTChristian Himpel2010-08-302-5/+4
| | | | | | | | | All scripts and makefiles assume that GOBIN is correctly set in PATH. R=rsc CC=golang-dev https://golang.org/cl/2043041
* build: no required environment variablesRuss Cox2010-08-181-1/+1
| | | | | | R=adg, r, PeterGo CC=golang-dev https://golang.org/cl/1942044
* cgo: various bug fixesRuss Cox2010-07-147-20/+206
| | | | | | | | | | | | | | | | | * remember #defined names, so that C.stdout can refer to the real name (on OS X) __stdoutp. * better handling of #defined constant expressions * allow n, err = C.strtol("asdf", 0, 123) to get errno as os.Error * write all output files to current directory * don't require gcc output if there was no input Fixes #533. Fixes #709. Fixes #756. R=r CC=dho, golang-dev, iant https://golang.org/cl/1734047
* 1) Change default gofmt default settings forRobert Griesemer2009-12-153-36/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | parsing and printing to new syntax. Use -oldparser to parse the old syntax, use -oldprinter to print the old syntax. 2) Change default gofmt formatting settings to use tabs for indentation only and to use spaces for alignment. This will make the code alignment insensitive to an editor's tabwidth. Use -spaces=false to use tabs for alignment. 3) Manually changed src/exp/parser/parser_test.go so that it doesn't try to parse the parser's source files using the old syntax (they have new syntax now). 4) gofmt -w src misc test/bench 1st set of files. R=rsc CC=agl, golang-dev, iant, ken2, r https://golang.org/cl/180047
* Remove GOBIN in PATH dependency; don't assume cwd is $GOROOT/srcDevon H. O'Dell2009-12-112-4/+5
| | | | | | | | | | | | This change removes the necessity to have GOBIN in $PATH, and also doesn't assume that the build is being run from $GOROOT/src. This is a minimal set of necessary changes to get Go to build happily from the FreeBSD ports collection. R=rsc CC=golang-dev https://golang.org/cl/171044
* go: makes it build for the case $GOROOT has whitespacesSergio Luis O. B. Correia2009-11-231-2/+2
| | | | | | | | | | | | | | | the bash scripts and makefiles for building go didn't take into account the fact $GOROOT / $GOBIN could both be directories containing whitespaces, and was not possible to build it in such a situation. this commit adjusts the various makefiles/scripts to make it aware of that possibility, and now it builds successfully when using a path with whitespaces as well. Fixes #115. R=rsc, dsymonds1 https://golang.org/cl/157067
* More FreeBSD-touchups. Thundercats are GOOOOO!Devon H. O'Dell2009-11-181-2/+0
| | | | | | R=rsc CC=golang-dev https://golang.org/cl/157074
* make all.bash finish on FreeBSDRuss Cox2009-11-181-0/+2
| | | | | | R=dho CC=golang-dev https://golang.org/cl/156067
* FreeBSD-specific porting work.Devon H. O'Dell2009-11-171-2/+2
| | | | | | | | | | cgo/libmach remain unimplemented. However, compilers, runtime, and packages are 100%. I still need to go through and implement missing syscalls (at least make sure they're all listed), but for all shipped functionality, this is done. Ship! ;) R=rsc, VenkateshSrinivas https://golang.org/cl/152142
* remove semis after statements in one-statement statement listsRobert Griesemer2009-11-092-2/+2
| | | | | R=rsc, r http://go/go-review/1025029
* gofmt -w miscRobert Griesemer2009-11-052-2/+1
| | | | | R=rsc http://go/go-review/1025004
* add cgo test that doesn't depend onRuss Cox2009-10-034-1/+209
| | | | | | | | | non-standard libraries and add to build. R=r DELTA=211 (210 added, 0 deleted, 1 changed) OCL=35293 CL=35307
* 8c, 8l dynamic loading support.Russ Cox2009-10-034-0/+119
better mach binaries. cgo working on darwin+linux amd64+386. eliminated context switches - pi is 30x faster. add libcgo to build. on snow leopard: - non-cgo binaries work; all tests pass. - cgo binaries work on amd64 but not 386. R=r DELTA=2031 (1316 added, 626 deleted, 89 changed) OCL=35264 CL=35304