1
0
mirror of https://github.com/golang/go synced 2024-11-19 12:14:42 -07:00
go/misc/cgo/testgodefs/test.bash
Ian Lance Taylor f135106ec7 cmd/cgo: add -srcdir option
This is convenient for direct use of `go tool cgo`. We can also use it
from the go tool to reduce the length of the file names that cgo
generates.

Update #17070.

Change-Id: I8466a0a2cc68a732d17d07319e303497715bac8c
Reviewed-on: https://go-review.googlesource.com/32354
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2016-10-30 19:14:08 +00:00

23 lines
590 B
Bash
Executable File

#!/usr/bin/env bash
# Copyright 2014 The Go Authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
# We are testing cgo -godefs, which translates Go files that use
# import "C" into Go files with Go definitions of types defined in the
# import "C" block. Add more tests here.
FILE_PREFIXES="anonunion issue8478"
RM=
for FP in $FILE_PREFIXES
do
go tool cgo -godefs -srcdir . ${FP}.go > ${FP}_defs.go
RM="${RM} ${FP}_defs.go"
done
go build . && ./testgodefs
EXIT=$?
rm -rf _obj testgodefs ${RM}
exit $EXIT