Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move conformance tests to own package #529

Merged
merged 8 commits into from
May 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 0 additions & 13 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,18 +48,5 @@ jobs:
rm ${archive}
protoc --version

- name: Install conformance-test-runner
run: |
version=22.3
archive=conformance_test_runner-${version}-linux-x86_64.zip
curl -O -L https://github.com/bufbuild/protobuf-conformance/releases/download/v${version}/${archive}
unzip ${archive}
# sudo cp libprotobuf.so.23 /usr/lib/
sudo cp ./bin/conformance_test_runner /usr/bin/
sudo chmod 755 /usr/bin/conformance_test_runner
# rm libprotobuf.so.23
rm -rf ./bin
rm ${archive}

- name: Run make
run: make
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ Read the [MANUAL](MANUAL.md) to learn more.
- The files [plugin.ts](./packages/plugin-framework/src/google/protobuf/compiler/plugin.ts) and [descriptor.ts](./packages/plugin-framework/src/google/protobuf/descriptor.ts) are Copyright 2008 Google Inc., licensed under BSD-3-Clause
- The [gRPC status codes](./packages/grpcweb-transport/src/goog-grpc-status-code.ts) are Copyright 2016 gRPC authors, licensed under Apache-2.0.
- The [Twirp error codes](./packages/twirp-transport/src/twitch-twirp-error-code.ts) are Copyright 2018 Twitch Interactive, Inc., licensed under Apache-2.0.
- The proto files in [test-fixtures/google](./packages/test-fixtures/google) and [test-fixtures/conformance](./packages/test-fixtures/conformance) are Copyright Google Inc. / Google LLC, licensed under Apache-2.0 / BSD-3-Clause.
- The proto files in [test-fixtures/google](./packages/test-fixtures/google) and [test-conformance/proto](./packages/test-conformance/proto) are Copyright Google Inc. / Google LLC, licensed under Apache-2.0 / BSD-3-Clause.
- The proto files in [test-fixtures/validate](./packages/test-fixtures/validate) are Copyright 2019 Envoy Project Authors, licensed under Apache License 2.0.
- All other files are licensed under Apache-2.0, see [LICENSE](./LICENSE).

Expand Down
2 changes: 2 additions & 0 deletions packages/test-conformance/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/node_modules
/bin
5 changes: 5 additions & 0 deletions packages/test-conformance/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.PHONY: default
default:
npm run generate
npm run lint
npm run test
12 changes: 12 additions & 0 deletions packages/test-conformance/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
@protobuf-ts/test-conformance
=============================

Runs binary and JSON format conformance, using googles
[conformance test runner](https://github.com/protocolbuffers/protobuf/tree/main/conformance).

`@protobuf-ts/plugin-framework`, `@protobuf-ts/plugin` and `@protobuf-ts/runtime`
must be built to run the tests. `make` executes all tests. See `Makefile`
for details.

The proto files in [proto/](./proto) are Copyright Google Inc. / Google
LLC, licensed under Apache-2.0 / BSD-3-Clause.
26 changes: 26 additions & 0 deletions packages/test-conformance/buf.gen.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
version: v1
plugins:
- plugin: ts
out: src/gen/optimize_speed-long_type_bigint
opt:
- long_type_bigint
- optimize_speed
- generate_dependencies
- plugin: ts
out: src/gen/optimize_speed-long_type_string
opt:
- long_type_string
- optimize_speed
- generate_dependencies
- plugin: ts
out: src/gen/optimize_code_size-long_type_bigint
opt:
- long_type_bigint
- optimize_code_size
- generate_dependencies
- plugin: ts
out: src/gen/optimize_code_size-long_type_string
opt:
- long_type_string
- optimize_code_size
- generate_dependencies
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env bash

npx tsx src/conformance-optimize_code_size-long_type_bigint.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env bash

npx tsx src/conformance-optimize_code_size-long_type_string.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env bash

npx tsx src/conformance-optimize_speed-long_type_bigint.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env bash

npx tsx src/conformance-optimize_speed-long_type_string.ts
20 changes: 20 additions & 0 deletions packages/test-conformance/download-conformance-runner.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env bash

if [ -f "bin/conformance_test_runner" ]; then
exit 0;
fi

GOOGLE_PROTOBUF_VERSION=22.3
UNAME_OS=$(uname -s)
if [[ "$UNAME_OS" == "Darwin" ]]; then
PLATFORM=osx-x86_64
elif [[ "$UNAME_OS" == "Linux" ]]; then
PLATFORM=linux-x86_64
else
>&2 echo "unsupported platform ${UNAME_OS}"
exit 1;
fi
ARCHIVE=conformance_test_runner-${GOOGLE_PROTOBUF_VERSION}-${PLATFORM}.zip
curl -O -L https://github.com/bufbuild/protobuf-conformance/releases/download/v${GOOGLE_PROTOBUF_VERSION}/${ARCHIVE}
unzip ${ARCHIVE}
rm ${ARCHIVE}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Recommended.Proto2.JsonInput.FieldNameExtension.Validator
Recommended.Proto3.JsonInput.NullValueInNormalMessage.Validator
Recommended.Proto3.JsonInput.NullValueInOtherOneofNewFormat.Validator
Recommended.Proto3.JsonInput.NullValueInOtherOneofOldFormat.Validator
Recommended.ValueRejectInfNumberValue.JsonOutput
Recommended.ValueRejectNanNumberValue.JsonOutput
Required.Proto3.JsonInput.DurationNegativeNanos.JsonOutput
Required.Proto3.JsonInput.DurationNegativeNanos.ProtobufOutput
Required.Proto3.JsonInput.EnumFieldWithAliasLowerCase.JsonOutput
Required.Proto3.JsonInput.EnumFieldWithAliasLowerCase.ProtobufOutput
Required.Proto3.JsonInput.EnumFieldWithAliasUseAlias.JsonOutput
Required.Proto3.JsonInput.EnumFieldWithAliasUseAlias.ProtobufOutput
Required.Proto3.JsonInput.OneofFieldNullFirst.JsonOutput
Required.Proto3.JsonInput.OneofFieldNullFirst.ProtobufOutput
Required.Proto3.JsonInput.OneofFieldNullSecond.JsonOutput
Required.Proto3.JsonInput.OneofFieldNullSecond.ProtobufOutput
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Recommended.Proto2.JsonInput.FieldNameExtension.Validator
Recommended.Proto3.JsonInput.NullValueInNormalMessage.Validator
Recommended.Proto3.JsonInput.NullValueInOtherOneofNewFormat.Validator
Recommended.Proto3.JsonInput.NullValueInOtherOneofOldFormat.Validator
Recommended.ValueRejectInfNumberValue.JsonOutput
Recommended.ValueRejectNanNumberValue.JsonOutput
Required.Proto3.JsonInput.DurationNegativeNanos.JsonOutput
Required.Proto3.JsonInput.DurationNegativeNanos.ProtobufOutput
Required.Proto3.JsonInput.EnumFieldWithAliasLowerCase.JsonOutput
Required.Proto3.JsonInput.EnumFieldWithAliasLowerCase.ProtobufOutput
Required.Proto3.JsonInput.EnumFieldWithAliasUseAlias.JsonOutput
Required.Proto3.JsonInput.EnumFieldWithAliasUseAlias.ProtobufOutput
Required.Proto3.JsonInput.OneofFieldNullFirst.JsonOutput
Required.Proto3.JsonInput.OneofFieldNullFirst.ProtobufOutput
Required.Proto3.JsonInput.OneofFieldNullSecond.JsonOutput
Required.Proto3.JsonInput.OneofFieldNullSecond.ProtobufOutput
Loading