Commit Graph

25 Commits

Author SHA1 Message Date
Herbie Ong
3924625c77 all: update to go1.13 release
Change-Id: Id090455ddf30620bd5be809a095d187afc2047c5
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/193937
Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
2019-09-06 18:27:08 +00:00
Joe Tsai
576cfb3dae release.bash: support reproducible builds
Manually specifying the "-buildid" removes the last source of variability
when the release binaries is built on one system or another.

See https://github.com/golang/go/issues/33772#issuecomment-528176001

Change-Id: Ibc9b8e99b5b76719735942a510570bcbf96dfea6
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/193498
Reviewed-by: Damien Neil <dneil@google.com>
2019-09-05 17:44:33 +00:00
Joe Tsai
08ff730048 all: add go1.13rc1 to list of supported Go versions
Change-Id: I2ba52055bcb0e434b66dbcd4763afd2fce5b4264
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/191179
Reviewed-by: Herbie Ong <herbie@google.com>
2019-08-21 21:14:39 +00:00
Joe Tsai
4f3de44102 release.bash: add support for building release binaries
Updates golang/protobuf#738

Change-Id: I6dd85ff0129bfcfb67b12b06549c568eebfd68e3
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/189342
Reviewed-by: Damien Neil <dneil@google.com>
2019-08-21 01:15:26 +00:00
Joe Tsai
dd271b6b63 internal/conformance: make conformance test use specific go version
The use of internal/cmd/conformance/conformance.sh means that the test
is not hermetic since the script uses the system version of go,
rather than the specific versions chosen by integration_test.go.

Change the way the conformance test is invoked by turning it
into a Go unit test that integration_test.go can directly call.

Change-Id: I37d23341e1eda984f23f78757a38e862e5fac3d4
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/190518
Reviewed-by: Herbie Ong <herbie@google.com>
2019-08-16 22:09:14 +00:00
Joe Tsai
abd06a8b30 all: update to protobuf-v3.9.1 and go-v1.11.13 and go-v1.12.9
A conformance test has been added for the text format.
Update our conformance runner to handle that format and
update with the list of current failures.

Change-Id: I36a271fcfbe328c4ee8c870caff4661659ad27ef
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/190517
Reviewed-by: Herbie Ong <herbie@google.com>
2019-08-16 18:12:10 +00:00
Joe Tsai
1799d1111a all: rename tag and flags for legacy support
Rename build tag "proto1_legacy" -> "protolegacy"
to be consistent with the "protoreflect" tag.

Rename flag constant "Proto1Legacy" -> "ProtoLegacy" since
it covers more than simply proto1 legacy features.
For example, it covers alpha-features of proto3 that
were eventually removed from the final proto3 release.

Change-Id: I0f4fcbadd4b5a61c87645e2e5be11d187e59157c
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/189345
Reviewed-by: Damien Neil <dneil@google.com>
2019-08-08 20:49:00 +00:00
Joe Tsai
7164af5a9d test.bash: refactor command execution logic
Refactor the command execution logic to be more configurable.

Change-Id: I6d21f6c3f38691a8ffc992a170ff221c8a06f990
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/189341
Reviewed-by: Damien Neil <dneil@google.com>
2019-08-08 20:23:56 +00:00
Joe Tsai
3d8e369c4e all: implement proto1 weak fields
This implements generation of and reflection support for weak fields.
Weak fields are a proto1 feature where the "weak" option can be specified
on a singular message field. A weak reference results in generated code
that does not directly link in the dependency containing the weak message.

Weak field support is not added to any of the serialization logic.

Change-Id: I08ccfa72bc80b2ffb6af527a1677a0a81dcf33fb
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/185399
Reviewed-by: Damien Neil <dneil@google.com>
2019-07-15 18:44:12 +00:00
Joe Tsai
62200db51e integration_test.go: use custom parallel test code
The t.Parallel method does not interact well with the -failfast flag.
See golang/go#30522.

Instead, start off tests ourselves in a goroutine.
Doing it this way allows the -failfast flag to take effect sooner.

One nice benefit of this change is that the test output is cleaner:

Before:
<<<
=== RUN   Test
=== RUN   Test/Go1.9.7
=== RUN   Test/Go1.9.7/TestNormal
=== PAUSE Test/Go1.9.7/TestNormal
=== RUN   Test/Go1.9.7/TestPureGo
=== PAUSE Test/Go1.9.7/TestPureGo
=== RUN   Test/Go1.9.7/TestReflect
=== PAUSE Test/Go1.9.7/TestReflect
=== CONT  Test/Go1.9.7/TestNormal
=== CONT  Test/Go1.9.7/TestReflect
=== CONT  Test/Go1.9.7/TestPureGo
=== RUN   Test/Go1.10.8
=== RUN   Test/Go1.10.8/TestNormal
=== PAUSE Test/Go1.10.8/TestNormal
=== RUN   Test/Go1.10.8/TestPureGo
=== PAUSE Test/Go1.10.8/TestPureGo
=== RUN   Test/Go1.10.8/TestReflect
=== PAUSE Test/Go1.10.8/TestReflect
=== CONT  Test/Go1.10.8/TestNormal
=== CONT  Test/Go1.10.8/TestReflect
=== CONT  Test/Go1.10.8/TestPureGo
=== RUN   Test/Go1.11.6
=== RUN   Test/Go1.11.6/TestNormal
=== PAUSE Test/Go1.11.6/TestNormal
=== RUN   Test/Go1.11.6/TestPureGo
=== PAUSE Test/Go1.11.6/TestPureGo
=== RUN   Test/Go1.11.6/TestReflect
=== PAUSE Test/Go1.11.6/TestReflect
=== CONT  Test/Go1.11.6/TestNormal
=== CONT  Test/Go1.11.6/TestReflect
=== CONT  Test/Go1.11.6/TestPureGo
=== RUN   Test/Go1.12.1
=== RUN   Test/Go1.12.1/TestNormal
=== PAUSE Test/Go1.12.1/TestNormal
=== RUN   Test/Go1.12.1/TestPureGo
=== PAUSE Test/Go1.12.1/TestPureGo
=== RUN   Test/Go1.12.1/TestReflect
=== PAUSE Test/Go1.12.1/TestReflect
=== RUN   Test/Go1.12.1/TestProto1Legacy
=== PAUSE Test/Go1.12.1/TestProto1Legacy
=== RUN   Test/Go1.12.1/TestProtocGenGo
=== PAUSE Test/Go1.12.1/TestProtocGenGo
=== RUN   Test/Go1.12.1/TestProtocGenGoGRPC
=== PAUSE Test/Go1.12.1/TestProtocGenGoGRPC
=== CONT  Test/Go1.12.1/TestNormal
=== CONT  Test/Go1.12.1/TestProto1Legacy
=== CONT  Test/Go1.12.1/TestProtocGenGoGRPC
=== CONT  Test/Go1.12.1/TestProtocGenGo
=== CONT  Test/Go1.12.1/TestReflect
=== CONT  Test/Go1.12.1/TestPureGo
=== RUN   Test/ConformanceTests
=== RUN   Test/GeneratedGoFiles
=== RUN   Test/FormattedGoFiles
=== RUN   Test/CommittedGitChanges
=== RUN   Test/TrackedGitFiles
--- PASS: Test (509.59s)
    --- PASS: Test/Go1.9.7 (0.00s)
        --- PASS: Test/Go1.9.7/TestReflect (100.81s)
        --- PASS: Test/Go1.9.7/TestNormal (100.88s)
        --- PASS: Test/Go1.9.7/TestPureGo (56.93s)
    --- PASS: Test/Go1.10.8 (0.00s)
        --- PASS: Test/Go1.10.8/TestNormal (64.85s)
        --- PASS: Test/Go1.10.8/TestReflect (65.20s)
        --- PASS: Test/Go1.10.8/TestPureGo (36.14s)
    --- PASS: Test/Go1.11.6 (0.00s)
        --- PASS: Test/Go1.11.6/TestReflect (59.69s)
        --- PASS: Test/Go1.11.6/TestNormal (60.25s)
        --- PASS: Test/Go1.11.6/TestPureGo (34.17s)
    --- PASS: Test/Go1.12.1 (0.00s)
        --- PASS: Test/Go1.12.1/TestProto1Legacy (59.41s)
        --- PASS: Test/Go1.12.1/TestNormal (59.87s)
        --- PASS: Test/Go1.12.1/TestProtocGenGo (3.55s)
        --- PASS: Test/Go1.12.1/TestProtocGenGoGRPC (4.12s)
        --- PASS: Test/Go1.12.1/TestReflect (60.10s)
        --- PASS: Test/Go1.12.1/TestPureGo (60.66s)
    --- PASS: Test/ConformanceTests (0.78s)
    --- PASS: Test/GeneratedGoFiles (8.99s)
    --- PASS: Test/FormattedGoFiles (2.64s)
    --- PASS: Test/CommittedGitChanges (0.10s)
    --- PASS: Test/TrackedGitFiles (0.00s)
PASS
>>>

After:
<<<
=== RUN   Test
=== RUN   Test/Go1.9.7/PureGo
=== RUN   Test/Go1.9.7/Normal
=== RUN   Test/Go1.9.7/Reflect
=== RUN   Test/Go1.10.8/Normal
=== RUN   Test/Go1.10.8/PureGo
=== RUN   Test/Go1.10.8/Reflect
=== RUN   Test/Go1.11.6/Normal
=== RUN   Test/Go1.11.6/PureGo
=== RUN   Test/Go1.11.6/Reflect
=== RUN   Test/Go1.12.1/Normal
=== RUN   Test/Go1.12.1/PureGo
=== RUN   Test/Go1.12.1/Reflect
=== RUN   Test/Go1.12.1/Proto1Legacy
=== RUN   Test/Go1.12.1/ProtocGenGo
=== RUN   Test/Go1.12.1/ProtocGenGoGRPC
=== RUN   Test/ConformanceTests
=== RUN   Test/GeneratedGoFiles
=== RUN   Test/FormattedGoFiles
=== RUN   Test/CommittedGitChanges
--- PASS: Test (182.87s)
    --- PASS: Test/Go1.9.7/PureGo (72.17s)
    --- PASS: Test/Go1.9.7/Normal (72.59s)
    --- PASS: Test/Go1.10.8/Normal (8.03s)
    --- PASS: Test/Go1.10.8/PureGo (8.03s)
    --- PASS: Test/Go1.10.8/Reflect (8.34s)
    --- PASS: Test/Go1.11.6/Normal (10.70s)
    --- PASS: Test/Go1.11.6/PureGo (8.21s)
    --- PASS: Test/Go1.11.6/Reflect (8.77s)
    --- PASS: Test/Go1.12.1/Normal (7.41s)
    --- PASS: Test/Go1.12.1/PureGo (6.52s)
    --- PASS: Test/Go1.12.1/Reflect (6.04s)
    --- PASS: Test/Go1.12.1/Proto1Legacy (6.96s)
    --- PASS: Test/Go1.12.1/ProtocGenGo (1.15s)
    --- PASS: Test/Go1.12.1/ProtocGenGoGRPC (2.43s)
    --- PASS: Test/Go1.9.7/Reflect (88.47s)
    --- PASS: Test/ConformanceTests (1.81s)
    --- PASS: Test/GeneratedGoFiles (16.28s)
    --- PASS: Test/FormattedGoFiles (3.17s)
    --- PASS: Test/CommittedGitChanges (0.17s)
PASS
>>>

Change-Id: I777ffe3f4d5f6407c87e3866cbaa890017204cba
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/185877
Reviewed-by: Herbie Ong <herbie@google.com>
2019-07-12 01:21:42 +00:00
Joe Tsai
6a2180f84e integration_test.go: move Go cache
Move the Go cache from .cache/gocache to .gocache.
This moves it out of the .cache directory so that Travis-CI will
not cache the Go cache.

Unfortunately, the Go toolchain's caching algorithm is not
aggressive enough in evicting old entries, causing Travis-CI
to keep caching an ever growing Go cache.
We're at the point where network IO moving a massive Go cache
is more costly than not having it at all.

Change-Id: I3104efcdb8fa81a550900e8d06299e50296386f3
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/185838
Reviewed-by: Herbie Ong <herbie@google.com>
2019-07-12 00:35:42 +00:00
Damien Neil
a80229e4ed proto: add benchmark using protobuf repo test data
The primary (cross-language) protobuf repository contains benchmark data
sets. Add benchmarks using this data. (A version of this benchmark exists
in the protobuf repository, but it uses the v1 API and isn't trivial to
get working.)

Fetch the small benchmark datasets from the
github.com/protocolbuffers/protobuf repo by default. Add a
download_benchdata.bash script which fetches the larger datasets as
well.

Generate necessary packages under internal/testprotos/benchmarks.

To run:

  go run ./proto -bench=BenchmarkData

Usual caveats about benchmarking apply: While these benchmarks use
realistic data, isolated microbenchmarking of proto operations is not
necessarily representitive of performance in production systems.

Change-Id: I58d107554baf104568c86997b5ad50be8b2a5790
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/183297
Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
2019-06-20 20:38:50 +00:00
Joe Tsai
a95b29fbf6 types: consistently name generated protos
Rename each generated protobuf package such that the base of the
Go package path is always equal to the Go package name to follow
proper Go package naming conventions.

The Go package name is derived from the .proto source file name by
replacing ".proto" with "pb" and stripping all underscores.

Change-Id: Iea05d1b5d94b1b2821ae10276ab771bb2df93c0e
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/177380
Reviewed-by: Damien Neil <dneil@google.com>
2019-05-16 21:55:40 +00:00
Damien Neil
e89e6244e0 all: change module to google.golang.org/protobuf
Temporarily remove go.mod, since we can't generate an accurate one until
the corresponding v1 change is submitted.

Change-Id: I1e1ad97f2b455e33f61ffaeb8676289795e47e72
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/177000
Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
2019-05-14 17:28:29 +00:00
Damien Neil
e5e4f36f7d internal/testprotos/conformance: make package name match dir
Change the rewritten Go package name for the conformance protos to match
the basename of the directory (i.e., "conformance").

This is a trivial change, but avoids confusion when the package name and
import path don't match.

Change-Id: I9b091c78ce4a85f7051c55ee1a48ef6dbba68db6
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/174944
Reviewed-by: Herbie Ong <herbie@google.com>
2019-05-02 18:46:11 +00:00
Herbie Ong
d64dcebbc7 integration_test: add conformance tests
Change-Id: I3c21e5069c34a6417c9177ae5f1bdcb801418c8a
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/173665
Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
2019-04-29 22:08:16 +00:00
Damien Neil
4419fabcb0 integration_test: drop "go build ./..."
This should be redundant with "go test ./...", and on pre-Go1.11 versions it
fails on directories that contain no non-test files.

Change-Id: I2c16cf3b26e67f3baa7732f0f7744aa547972e1a
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/172237
Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
2019-04-16 06:05:21 +00:00
Damien Neil
cc2b078f98 proto: enable/disable fast path with build tags
Remove the Reflection field from MarshalOptions and UnmarshalOptions.
Disable the fast path and use the reflection-based implementation when
the 'protoreflect' build tag is set.

Change-Id: Ic674e3af67501de27fb03ec2712fbed40eae7fef
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/170896
Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
2019-04-07 17:00:00 +00:00
Joe Tsai
9d19e5c432 test.bash: update to protoc3.7.1 and go1.11.6 and go1.12.1
Change-Id: I787ffa48dc075c74fe51737dfc98f23371c0b189
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/170628
Reviewed-by: Herbie Ong <herbie@google.com>
2019-04-04 01:07:53 +00:00
Herbie Ong
4630b3daa6 integration_test: fix race condition between stderr and stdout
Split output of stderr and stdout instead of using combined buffer.

Change-Id: I4099ebca15099e91539b3ebab6b410fc49f76ce1
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/168347
Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
2019-03-19 23:48:10 +00:00
Joe Tsai
9e88bc0b67 test.bash: purge unused directories based on timeout
Rather than manually keeping track of which directories may be used
by other branches, use a time-based approach to determine whether
to purge a sub-directory or not.

Change-Id: I648dcca075e351e4e5624c48e73792782fc349ca
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/167042
Reviewed-by: Herbie Ong <herbie@google.com>
2019-03-12 17:29:50 +00:00
Joe Tsai
bb786ea59e test.bash: update to protobuf 3.7.0
Change-Id: Id1237eaf92d6a07c57b279a59fb6bd794af0f231
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/167041
Reviewed-by: Herbie Ong <herbie@google.com>
2019-03-12 08:34:56 +00:00
Joe Tsai
d56458e71b internal/cmd/generate-protos: generate test for testdata
Running "go build ./..." does not descend into testdata directories.
However, the testdata in this repository is source code that is
intended to build properly. We could rename the directory, but that does
not test whether the generated packages can initialize properly.

Thus, we generate a trivial test that simply blank imports all packages.

Doing this reveals that some of the generated files have incorrect imports,
leading to registration conflicts.

To avoid introducing a dependency on gRPC from our go.mod file, we put
the testdata directories in their own module. Also, we avoid running
internal/testprotos through the grpc plugin because the servie and method
definitions in that directory are more for testing proto file initialization
rather than testing grpc generation.

Change-Id: Iaa6a06449787a085200e31bc7606e3ac904d3180
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/164917
Reviewed-by: Damien Neil <dneil@google.com>
2019-03-11 19:40:53 +00:00
Joe Tsai
f398784f99 .travis.yml: fix travis CI
Changes made:
* Call autogen.sh before building protobuf.
It's unclear how this worked before, but the README instructions for
protobuf does state to run autogen.sh prior to building and installing.
* Fix downloadArchive to take in a prefix path rather than the number of
prefix directories to skip. The reason for this change is due to a bug
in the Go build system where unexpected directories were being packed.
See https://golang.org/issue/29906
* Explicitly set Travis dist to be "xenial", which comes with Go1.11.
We require Go1.11 for two reasons:
	* The use of t.Helper in integration_test.go
	* Proper understanding of the -mod=vendor flag
	(even if all that flag does is disable modules).
* Add a hack to integration_test.go to periodically output the timestamp
to work around a restriction in Travis where it auto-kills the test
after 10 minutes of no stdout activity.

Change-Id: I114fe2855faeed091c34d79df3d97068be7eccd8
Reviewed-on: https://go-review.googlesource.com/c/164919
Reviewed-by: Herbie Ong <herbie@google.com>
2019-03-03 00:55:36 +00:00
Joe Tsai
707894e869 test.bash: rewrite the integration test in Go
This CL switches the integration test to be written in Go instead of bash.
The benefits are:
* The logic for setting up the dependencies is more robust and
handles better a situation where the dependency failed to initialize
(due to network trouble, FS permission problems, etc).
* The logic does a better job at cleaning up stale dependencies.
For example, my .cache folder has go1.9.4, go1.9.5, go1.10.5, and go1.10.6
folders even though we don't use them anymore.
* Being able to run only a subset of the integration test since you can
pass "-run" to the script.
* A signifcant amount of complexity in the test.bash script was running
the tests in parallel. This is trivial to do in Go.

The major detriment is that Go is more verbose as a "scripting" language.

Change-Id: Id7e5b303fb305fdbc0368bdf809dbf29fca1d983
Reviewed-on: https://go-review.googlesource.com/c/164861
Reviewed-by: Herbie Ong <herbie@google.com>
2019-03-02 00:04:20 +00:00