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

Fixes failing tests by regenerating test cases
This commit is contained in:
mustiikhalil 2022-09-10 07:35:42 +02:00 committed by GitHub
parent f124e41ae6
commit a67e35aff9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
38 changed files with 23 additions and 23 deletions

4
.github/labeler.yml vendored
View File

@ -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:

View File

@ -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:
@ -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:

View File

@ -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.*

View File

@ -64,7 +64,7 @@ assert flatc_path.exists(), "Cannot find the flatc compiler " + str(flatc_path)
# 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")
@ -395,7 +395,7 @@ dictionary_lookup_schema = "dictionary_lookup.fbs"
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",

View File

@ -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

View File

@ -23,7 +23,7 @@ let package = Package(
.macOS(.v10_14),
],
dependencies: [
.package(path: "../../swift/"),
.package(path: "../../../swift"),
],
targets: [
.target(

View File

@ -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")]),
])

View File

@ -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: [

View File

@ -1,16 +1,18 @@
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
@ -18,14 +20,14 @@ fbc --swift --gen-mutable --grpc --gen-json-emit --gen-object-api --swift-implem
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