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

Moves all of the swift test code into tests/swift #7509

Merged
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 1 addition & 3 deletions .github/labeler.yml
Expand Up @@ -15,9 +15,7 @@ c#:
swift:
- '**/*.swift'
- swift/**/*
- tests/FlatBuffers.GRPC.Swift/**/*
- tests/FlatBuffers.Benchmarks.swift/**/*
- tests/FlatBuffers.Test.Swift/**/*
- tests/swift/**
- src/idl_gen_swift.cpp

javascript:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Expand Up @@ -422,7 +422,7 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: test
working-directory: tests/FlatBuffers.Test.Swift
working-directory: tests/swift/tests
run: sh SwiftTest.sh

build-swift-wasm:
Expand All @@ -435,7 +435,7 @@ jobs:
- name: Setup Wasmer
uses: wasmerio/setup-wasmer@v1
- name: Test
working-directory: tests/FlatBuffers.Test.Swift.Wasm
working-directory: tests/swift/Wasm.tests
run: carton test

build-ts:
Expand Down
6 changes: 3 additions & 3 deletions docs/source/SwiftUsage.md
Expand Up @@ -22,10 +22,10 @@ GitHub page](https://github.com/google/flatbuffers/tree/master/swift).

## Testing the FlatBuffers Swift library

The code to test the Swift library can be found at `flatbuffers/Flatbuffers.Test.Swift`.
The test code itself is located in [Flatbuffers.Test.Swift](https://github.com/google/flatbuffers/blob/master/tests/FlatBuffers.Test.Swift).
The code to test the Swift library can be found at `flatbuffers/tests/swift/tests`.
The test code itself is located in [flatbuffers/tests/swift/tests](https://github.com/google/flatbuffers/blob/master/tests/swift/tests).

To run the tests, use the [SwiftTest.sh](https://github.com/google/flatbuffers/blob/master/tests/FlatBuffers.Test.Swift/SwiftTest.sh) shell script.
To run the tests, use the [SwiftTest.sh](https://github.com/google/flatbuffers/blob/master/tests/swift/tests/SwiftTest.sh) shell script.

*Note: The shell script requires [Swift](https://swift.org) to
be installed.*
Expand Down
4 changes: 2 additions & 2 deletions scripts/generate_code.py
Expand Up @@ -64,7 +64,7 @@

# Specify the other paths that will be referenced
tests_path = Path(root_path, "tests")
swift_code_gen = Path(root_path, "tests/FlatBuffers.Test.Swift/CodeGenerationTests")
swift_code_gen = Path(root_path, "tests/swift/tests/CodeGenerationTests")
samples_path = Path(root_path, "samples")
reflection_path = Path(root_path, "reflection")

Expand Down Expand Up @@ -395,7 +395,7 @@ def glob(path, pattern):
flatc(["--java", "--kotlin"], schema=dictionary_lookup_schema)

# Swift Tests
swift_prefix = "FlatBuffers.Test.Swift/Tests/FlatBuffers.Test.SwiftTests"
swift_prefix = "swift/tests/Tests/FlatBuffers.Test.SwiftTests"
flatc(
SWIFT_OPTS + BASE_OPTS + ["--grpc"],
schema="monster_test.fbs",
Expand Down
2 changes: 1 addition & 1 deletion tests/docker/languages/Dockerfile.testing.swift_5_2
Expand Up @@ -4,5 +4,5 @@ ADD . .
RUN cp flatc_debian_stretch flatc
WORKDIR /code/tests
RUN swift --version
WORKDIR /code/tests/FlatBuffers.Test.Swift
WORKDIR /code/tests/swift/tests/
RUN sh SwiftTest.sh
Expand Up @@ -23,7 +23,7 @@ let package = Package(
.macOS(.v10_14),
],
dependencies: [
.package(path: "../../swift/"),
.package(path: "../../../swift"),
],
targets: [
.target(
Expand Down
Expand Up @@ -18,17 +18,17 @@
import PackageDescription

let package = Package(
name: "FlatBuffers.Benchmarks.swift",
name: "benchmarks",
platforms: [
.macOS(.v10_14),
],
dependencies: [
.package(path: "../../swift"),
.package(path: "../../../swift"),
.package(url: "https://github.com/google/swift-benchmark", from: "0.1.0"),
],
targets: [
.target(
name: "FlatBuffers.Benchmarks.swift",
name: "benchmarks",
dependencies: ["FlatBuffers",
.product(name: "Benchmark", package: "swift-benchmark")]),
])
Expand Up @@ -24,7 +24,7 @@ let package = Package(
.macOS(.v10_14),
],
dependencies: [
.package(path: "../../swift/"),
.package(path: "../../../swift"),
.package(url: "https://github.com/grpc/grpc-swift.git", from: "1.4.1"),
],
targets: [
Expand Down
@@ -1,31 +1,33 @@
current_dir=`pwd`
cd ..
swift_dir=`pwd`
cd ..
test_dir=`pwd`
alias fbc='${test_dir}/../flatc'
shopt -s expand_aliases

cd ${swift_dir}/Tests/FlatBuffers.Test.SwiftTests
cd ${current_dir}/Tests/FlatBuffers.Test.SwiftTests
fbc --swift --gen-mutable --grpc --gen-json-emit --gen-object-api -I ${test_dir}/include_test ${test_dir}/monster_test.fbs ${test_dir}/union_vector/union_vector.fbs
fbc --swift --gen-json-emit ${test_dir}/optional_scalars.fbs
fbc --swift --gen-json-emit --gen-object-api ${test_dir}/more_defaults.fbs
fbc --swift --gen-json-emit --gen-mutable --gen-object-api ${test_dir}/MutatingBool.fbs
fbc --swift ${test_dir}/vector_has_test.fbs
cd ${swift_dir}
fbc --swift --gen-json-emit ${test_dir}/vector_has_test.fbs
cd ${current_dir}

# Goes into the code generation tests
cd CodeGenerationTests
fbc --swift --gen-mutable --grpc --gen-json-emit --gen-object-api --swift-implementation-only test_import.fbs
fbc --swift --gen-mutable --grpc --gen-json-emit --gen-object-api --no-includes test_no_include.fbs
cd ..

cd ${swift_dir}/Sources/SwiftFlatBuffers
cd ${current_dir}/Sources/SwiftFlatBuffers
# create better fuzzing test file
fbc --swift --gen-json-emit fuzzer.fbs
cd ${swift_dir}
cd ${current_dir}

cd ${test_dir}/Flatbuffers.Test.Swift.WASM/Tests/FlatBuffers.Test.Swift.WASMTests
cd ${swift_dir}/Wasm.tests/Tests/FlatBuffers.Test.Swift.WasmTests
fbc --swift --gen-mutable --gen-json-emit --gen-object-api -I ${test_dir}/include_test ${test_dir}/monster_test.fbs
cd ${swift_dir}
cd ${current_dir}

swift build --build-tests
swift test
Expand Down