@voxgig/sdkgen 4.8.2 → 4.8.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/voxgig-sdkgen +1 -1
- package/dist/action/doctor.d.ts +1 -0
- package/dist/action/doctor.js +50 -2
- package/dist/action/doctor.js.map +1 -1
- package/dist/helpers/naming.js +4 -2
- package/dist/helpers/naming.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/model/sdkgen.aon +21 -0
- package/package.json +1 -1
- package/project/.sdk/model/feature/secrets.aon +120 -18
- package/project/.sdk/model/target/c.aon +10 -0
- package/project/.sdk/model/target/clojure.aon +13 -0
- package/project/.sdk/model/target/cpp.aon +10 -0
- package/project/.sdk/model/target/csharp.aon +9 -0
- package/project/.sdk/model/target/dart.aon +10 -0
- package/project/.sdk/model/target/elixir.aon +9 -0
- package/project/.sdk/model/target/go.aon +13 -0
- package/project/.sdk/model/target/java.aon +9 -0
- package/project/.sdk/model/target/js.aon +7 -0
- package/project/.sdk/model/target/kotlin.aon +9 -0
- package/project/.sdk/model/target/lean.aon +17 -0
- package/project/.sdk/model/target/lua.aon +8 -0
- package/project/.sdk/model/target/ocaml.aon +9 -0
- package/project/.sdk/model/target/perl.aon +8 -0
- package/project/.sdk/model/target/php.aon +8 -0
- package/project/.sdk/model/target/py.aon +13 -0
- package/project/.sdk/model/target/rb.aon +8 -0
- package/project/.sdk/model/target/rust.aon +10 -0
- package/project/.sdk/model/target/scala.aon +21 -2
- package/project/.sdk/model/target/swift.aon +18 -0
- package/project/.sdk/model/target/ts.aon +13 -0
- package/project/.sdk/src/cmp/clojure/Package_clojure.ts +9 -2
- package/project/.sdk/src/cmp/cpp/Gitignore_cpp.ts +3 -0
- package/project/.sdk/src/cmp/dart/Test_dart.ts +2 -0
- package/project/.sdk/src/cmp/elixir/Package_elixir.ts +4 -1
- package/project/.sdk/src/cmp/go/Config_go.ts +59 -2
- package/project/.sdk/src/cmp/go/Main_go.ts +8 -2
- package/project/.sdk/src/cmp/java/Test_java.ts +6 -5
- package/project/.sdk/src/cmp/kotlin/Test_kotlin.ts +6 -5
- package/project/.sdk/src/cmp/lean/Package_lean.ts +23 -0
- package/project/.sdk/src/cmp/lean/ReadmeInstall_lean.ts +1 -0
- package/project/.sdk/src/cmp/lean/ReadmeTopTest_lean.ts +1 -0
- package/project/.sdk/src/cmp/ocaml/Gitignore_ocaml.ts +1 -0
- package/project/.sdk/src/cmp/ocaml/Main_ocaml.ts +7 -3
- package/project/.sdk/src/cmp/py/Config_py.ts +82 -1
- package/project/.sdk/src/cmp/py/Main_py.ts +44 -0
- package/project/.sdk/src/cmp/py/fragment/Main.fragment.py +2 -0
- package/project/.sdk/src/cmp/swift/Main_swift.ts +10 -0
- package/project/.sdk/src/cmp/swift/Package_swift.ts +13 -1
- package/project/.sdk/src/cmp/ts/Config_ts.ts +42 -17
- package/project/.sdk/src/cmp/ts/fragment/Config.data.fragment.ts +13 -1
- package/project/.sdk/src/cmp/ts/fragment/Config.fragment.ts +13 -1
- package/project/.sdk/tm/c/Makefile +38 -3
- package/project/.sdk/tm/c/tests/omni_resolver.h +361 -0
- package/project/.sdk/tm/c/tests/omni_smoke_test.c +237 -0
- package/project/.sdk/tm/c/tests/primary_corpus_test.c +205 -284
- package/project/.sdk/tm/c/tests/struct_corpus_test.c +292 -212
- package/project/.sdk/tm/c/tests/vendor/omni/json.c +811 -0
- package/project/.sdk/tm/c/tests/vendor/omni/omni.h +240 -0
- package/project/.sdk/tm/c/tests/vendor/omni/runner.c +940 -0
- package/project/.sdk/tm/c/tests/vendor/omni/util.c +351 -0
- package/project/.sdk/tm/c/utility/struct/utility.c +7 -2
- package/project/.sdk/tm/clojure/test/sdk/test/omni.clj +401 -0
- package/project/.sdk/tm/clojure/test/sdk/test/omni_smoke.clj +81 -0
- package/project/.sdk/tm/clojure/test/sdk/test/primary.clj +92 -58
- package/project/.sdk/tm/clojure/test/sdk/test/struct_corpus.clj +122 -149
- package/project/.sdk/tm/clojure/test/sdk/test_runner.clj +8 -3
- package/project/.sdk/tm/clojure/test/vendor/omni/voxgig/omni/json.clj +145 -0
- package/project/.sdk/tm/clojure/test/vendor/omni/voxgig/omni/runner.clj +445 -0
- package/project/.sdk/tm/clojure/test/vendor/omni/voxgig/omni/util.clj +145 -0
- package/project/.sdk/tm/cpp/Makefile +5 -1
- package/project/.sdk/tm/cpp/test/omni_resolver.hpp +473 -0
- package/project/.sdk/tm/cpp/test/omni_smoke_test.cpp +209 -0
- package/project/.sdk/tm/cpp/test/primary_utility_test.cpp +243 -184
- package/project/.sdk/tm/cpp/test/runner_support.hpp +68 -181
- package/project/.sdk/tm/cpp/test/struct_corpus_test.cpp +183 -56
- package/project/.sdk/tm/cpp/test/vendor/omni/json.hpp +406 -0
- package/project/.sdk/tm/cpp/test/vendor/omni/omni.hpp +751 -0
- package/project/.sdk/tm/cpp/test/vendor/omni/util.hpp +256 -0
- package/project/.sdk/tm/cpp/utility/pipeline.hpp +7 -1
- package/project/.sdk/tm/csharp/test/OmniResolver.cs +491 -0
- package/project/.sdk/tm/csharp/test/OmniSmokeTest.cs +106 -0
- package/project/.sdk/tm/csharp/test/PrimaryUtilityTest.cs +299 -316
- package/project/.sdk/tm/csharp/test/Runner.cs +104 -269
- package/project/.sdk/tm/csharp/test/StructUtilityTest.cs +535 -724
- package/project/.sdk/tm/csharp/test/vendor/omni/Runner.cs +864 -0
- package/project/.sdk/tm/csharp/test/vendor/omni/Util.cs +347 -0
- package/project/.sdk/tm/csharp/utility/MakeSpec.cs +3 -1
- package/project/.sdk/tm/csharp/utility/PrepareMethod.cs +6 -1
- package/project/.sdk/tm/csharp/utility/struct/Struct.cs +21 -5
- package/project/.sdk/tm/dart/test/omni.dart +520 -0
- package/project/.sdk/tm/dart/test/omni_smoke_test.dart +143 -0
- package/project/.sdk/tm/dart/test/primary_test.dart +86 -28
- package/project/.sdk/tm/dart/test/struct_test.dart +438 -11
- package/project/.sdk/tm/dart/test/vendor/omni/omni.dart +7 -0
- package/project/.sdk/tm/dart/test/vendor/omni/runner.dart +653 -0
- package/project/.sdk/tm/dart/test/vendor/omni/util.dart +232 -0
- package/project/.sdk/tm/elixir/Makefile +11 -3
- package/project/.sdk/tm/elixir/test/omni_smoke_test.exs +117 -0
- package/project/.sdk/tm/elixir/test/primary_utility_test.exs +341 -16
- package/project/.sdk/tm/elixir/test/struct_corpus_test.exs +554 -9
- package/project/.sdk/tm/elixir/test/support/omni.ex +377 -0
- package/project/.sdk/tm/elixir/test/vendor/omni/json.ex +122 -0
- package/project/.sdk/tm/elixir/test/vendor/omni/runner.ex +623 -0
- package/project/.sdk/tm/elixir/test/vendor/omni/util.ex +187 -0
- package/project/.sdk/tm/go/core/context.go +32 -16
- package/project/.sdk/tm/go/feature/secrets/plugin/capability.go +261 -0
- package/project/.sdk/tm/go/feature/secrets/plugin/catalog.go +78 -0
- package/project/.sdk/tm/go/feature/secrets/plugin/config.go +652 -0
- package/project/.sdk/tm/go/feature/secrets/plugin/depend.go +250 -0
- package/project/.sdk/tm/go/feature/secrets/plugin/env.go +194 -0
- package/project/.sdk/tm/go/feature/secrets/plugin/export.go +80 -0
- package/project/.sdk/tm/go/feature/secrets/plugin/graph.go +238 -0
- package/project/.sdk/tm/go/feature/secrets/plugin/host.go +1575 -0
- package/project/.sdk/tm/go/feature/secrets/plugin/order.go +248 -0
- package/project/.sdk/tm/go/feature/secrets/plugin/point.go +184 -0
- package/project/.sdk/tm/go/feature/secrets/plugin/ref.go +123 -0
- package/project/.sdk/tm/go/feature/secrets/plugin/resolve.go +79 -0
- package/project/.sdk/tm/go/feature/secrets/plugin/types.go +296 -0
- package/project/.sdk/tm/go/feature/secrets/plugin/util.go +87 -0
- package/project/.sdk/tm/go/feature/secrets/plugin/version.go +161 -0
- package/project/.sdk/tm/go/feature/secrets/plugins/aws/aws.go +292 -0
- package/project/.sdk/tm/go/feature/secrets/plugins/aws/sigv4.go +201 -0
- package/project/.sdk/tm/go/feature/secrets/plugins/azuresecrets/azuresecrets.go +187 -0
- package/project/.sdk/tm/go/feature/secrets/plugins/boru/boru.go +184 -0
- package/project/.sdk/tm/go/feature/secrets/plugins/doppler/doppler.go +114 -0
- package/project/.sdk/tm/go/feature/secrets/plugins/gcpsecrets/gcpsecrets.go +156 -0
- package/project/.sdk/tm/go/feature/secrets/plugins/hashicorp/hashicorp.go +209 -0
- package/project/.sdk/tm/go/feature/secrets/plugins/httpjson/httpjson.go +241 -0
- package/project/.sdk/tm/go/feature/secrets/plugins/infisical/infisical.go +151 -0
- package/project/.sdk/tm/go/feature/secrets/plugins/onepassword/onepassword.go +152 -0
- package/project/.sdk/tm/go/feature/secrets/plugins/secretspec/secretspec.go +143 -0
- package/project/.sdk/tm/go/feature/secrets/sekreto/addr.go +120 -0
- package/project/.sdk/tm/go/feature/secrets/sekreto/providers.go +439 -0
- package/project/.sdk/tm/go/feature/secrets/sekreto/sekreto.go +685 -0
- package/project/.sdk/tm/go/feature/secrets_feature.go +675 -0
- package/project/.sdk/tm/go/src/feature/secrets/.gitkeep +0 -0
- package/project/.sdk/tm/go/test/feature/secrets/secrets_feature_test.go +799 -0
- package/project/.sdk/tm/go/test/omni/omni.go +897 -0
- package/project/.sdk/tm/go/test/omni/util.go +360 -0
- package/project/.sdk/tm/go/test/omniresolver_test.go +748 -0
- package/project/.sdk/tm/go/test/omnismoke_test.go +112 -0
- package/project/.sdk/tm/go/test/primary_utility_test.go +123 -191
- package/project/.sdk/tm/go/test/struct_utility_test.go +323 -16
- package/project/.sdk/tm/go/test/testsupport_test.go +294 -0
- package/project/.sdk/tm/go/utility/make_options.go +8 -1
- package/project/.sdk/tm/go/utility/prepare_method.go +5 -1
- package/project/.sdk/tm/go/utility/struct/voxgigstruct.go +2 -2
- package/project/.sdk/tm/java/test/OmniResolver.java +355 -0
- package/project/.sdk/tm/java/test/OmniSmokeTest.java +99 -0
- package/project/.sdk/tm/java/test/PrimaryUtilityTest.java +254 -280
- package/project/.sdk/tm/java/test/RunnerSupport.java +9 -194
- package/project/.sdk/tm/java/test/StructCorpusTest.java +119 -42
- package/project/.sdk/tm/java/test/vendor/omni/Json.java +287 -0
- package/project/.sdk/tm/java/test/vendor/omni/Runner.java +851 -0
- package/project/.sdk/tm/java/test/vendor/omni/Util.java +322 -0
- package/project/.sdk/tm/java/utility/MakeSpec.java +3 -1
- package/project/.sdk/tm/java/utility/PrepareMethod.java +5 -5
- package/project/.sdk/tm/java/utility/struct/Struct.java +17 -4
- package/project/.sdk/tm/js/src/utility/StructUtility.js +3 -3
- package/project/.sdk/tm/js/test/omni.js +251 -0
- package/project/.sdk/tm/js/test/omni.test.js +105 -0
- package/project/.sdk/tm/js/test/utility/PrimaryUtility.test.js +6 -2
- package/project/.sdk/tm/js/test/utility/StructUtility.test.js +27 -2
- package/project/.sdk/tm/js/test/vendor/omni/index.js +77 -0
- package/project/.sdk/tm/js/test/vendor/omni/runner.js +613 -0
- package/project/.sdk/tm/js/test/vendor/omni/util.js +212 -0
- package/project/.sdk/tm/kotlin/core/Utility.kt +1 -1
- package/project/.sdk/tm/kotlin/test/OmniResolver.kt +343 -0
- package/project/.sdk/tm/kotlin/test/OmniSmokeTest.kt +100 -0
- package/project/.sdk/tm/kotlin/test/PrimaryUtilityTest.kt +244 -262
- package/project/.sdk/tm/kotlin/test/RunnerSupport.kt +9 -178
- package/project/.sdk/tm/kotlin/test/StructCorpusTest.kt +121 -32
- package/project/.sdk/tm/kotlin/test/vendor/omni/Json.kt +264 -0
- package/project/.sdk/tm/kotlin/test/vendor/omni/Runner.kt +615 -0
- package/project/.sdk/tm/kotlin/test/vendor/omni/Util.kt +139 -0
- package/project/.sdk/tm/kotlin/utility/MakeSpecUrl.kt +6 -3
- package/project/.sdk/tm/kotlin/utility/Prepare.kt +6 -6
- package/project/.sdk/tm/kotlin/utility/struct/Struct.kt +18 -2
- package/project/.sdk/tm/lean/Makefile +12 -5
- package/project/.sdk/tm/lean/src/SdkUtility.lean +14 -1
- package/project/.sdk/tm/lean/test/OmniResolver.lean +358 -0
- package/project/.sdk/tm/lean/test/OmniSmoke.lean +174 -0
- package/project/.sdk/tm/lean/test/StructCorpus.lean +245 -574
- package/project/.sdk/tm/lean/test/TPrimaryUtility.lean +155 -291
- package/project/.sdk/tm/lean/test/vendor/omni/Omni.lean +997 -0
- package/project/.sdk/tm/lua/test/omni.lua +456 -0
- package/project/.sdk/tm/lua/test/omni_smoke_test.lua +103 -0
- package/project/.sdk/tm/lua/test/primary_utility_test.lua +250 -509
- package/project/.sdk/tm/lua/test/struct_utility_test.lua +161 -70
- package/project/.sdk/tm/lua/test/vendor/omni/json.lua +268 -0
- package/project/.sdk/tm/lua/test/vendor/omni/regex.lua +385 -0
- package/project/.sdk/tm/lua/test/vendor/omni/runner.lua +641 -0
- package/project/.sdk/tm/lua/test/vendor/omni/util.lua +282 -0
- package/project/.sdk/tm/lua/utility/prepare_method.lua +5 -1
- package/project/.sdk/tm/lua/utility/struct/regex.lua +663 -0
- package/project/.sdk/tm/lua/utility/struct/struct.lua +660 -420
- package/project/.sdk/tm/ocaml/Makefile +37 -12
- package/project/.sdk/tm/ocaml/test/omni_resolver.ml +284 -0
- package/project/.sdk/tm/ocaml/test/omni_smoke_test.ml +169 -0
- package/project/.sdk/tm/ocaml/test/primary_utility_test.ml +84 -100
- package/project/.sdk/tm/ocaml/test/struct_corpus.ml +225 -201
- package/project/.sdk/tm/ocaml/test/vendor/omni/omni.ml +1157 -0
- package/project/.sdk/tm/perl/lib/Voxgig/Struct.pm +88 -12
- package/project/.sdk/tm/perl/t/omni.pm +647 -0
- package/project/.sdk/tm/perl/t/omni_smoke.t +87 -0
- package/project/.sdk/tm/perl/t/primary_utility.t +189 -487
- package/project/.sdk/tm/perl/t/struct_utility.t +455 -389
- package/project/.sdk/tm/perl/t/vendor/omni/Voxgig/Omni/Runner.pm +649 -0
- package/project/.sdk/tm/perl/t/vendor/omni/Voxgig/Omni/Util.pm +253 -0
- package/project/.sdk/tm/perl/t/vendor/omni/Voxgig/Omni.pm +24 -0
- package/project/.sdk/tm/perl/utility/prepare_method.pm +7 -2
- package/project/.sdk/tm/php/test/Omni.php +691 -0
- package/project/.sdk/tm/php/test/OmniSmokeTest.php +93 -0
- package/project/.sdk/tm/php/test/PrimaryUtilityTest.php +210 -571
- package/project/.sdk/tm/php/test/StructUtilityTest.php +320 -342
- package/project/.sdk/tm/php/test/vendor/omni/Runner.php +644 -0
- package/project/.sdk/tm/php/test/vendor/omni/Util.php +283 -0
- package/project/.sdk/tm/php/utility/MakeSpec.php +10 -3
- package/project/.sdk/tm/php/utility/PrepareBody.php +7 -1
- package/project/.sdk/tm/php/utility/PrepareMethod.php +6 -2
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_plugin/__init__.py +36 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_plugin/capability.py +141 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_plugin/catalog.py +50 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_plugin/config.py +333 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_plugin/depend.py +198 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_plugin/env.py +147 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_plugin/export.py +52 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_plugin/graph.py +139 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_plugin/host.py +1053 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_plugin/order.py +171 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_plugin/point.py +95 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_plugin/ref.py +116 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_plugin/resolve.py +59 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_plugin/types.py +87 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_plugin/version.py +112 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_sekreto/__init__.py +74 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_sekreto/addr.py +116 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_sekreto/plugins/aws.py +192 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_sekreto/plugins/azuresecrets.py +120 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_sekreto/plugins/boru.py +140 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_sekreto/plugins/doppler.py +62 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_sekreto/plugins/gcpsecrets.py +101 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_sekreto/plugins/hashicorp.py +152 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_sekreto/plugins/httpjson.py +115 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_sekreto/plugins/infisical.py +92 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_sekreto/plugins/onepassword.py +101 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_sekreto/plugins/secretspec.py +119 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_sekreto/plugins/sigv4.py +125 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_sekreto/providers.py +211 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_sekreto/sekreto.py +455 -0
- package/project/.sdk/tm/py/pkg/feature/secrets_feature.py +467 -0
- package/project/.sdk/tm/py/pkg/utility/prepare_method.py +5 -1
- package/project/.sdk/tm/py/pkg/utility/voxgig_struct/__init__.py +0 -2
- package/project/.sdk/tm/py/pkg/utility/voxgig_struct/voxgig_struct.py +780 -529
- package/project/.sdk/tm/py/src/feature/secrets/.gitkeep +0 -0
- package/project/.sdk/tm/py/test/feature/__init__.py +0 -0
- package/project/.sdk/tm/py/test/feature/secrets/__init__.py +0 -0
- package/project/.sdk/tm/py/test/feature/secrets/test_secrets.py +337 -0
- package/project/.sdk/tm/py/test/omni.py +415 -0
- package/project/.sdk/tm/py/test/test_omni_smoke.py +74 -0
- package/project/.sdk/tm/py/test/test_primary_utility.py +144 -668
- package/project/.sdk/tm/py/test/test_struct_utility.py +74 -27
- package/project/.sdk/tm/py/test/voxgig_omni/__init__.py +62 -0
- package/project/.sdk/tm/py/test/voxgig_omni/runner.py +566 -0
- package/project/.sdk/tm/py/test/voxgig_omni/util.py +237 -0
- package/project/.sdk/tm/rb/test/omni.rb +505 -0
- package/project/.sdk/tm/rb/test/omni_smoke_test.rb +72 -0
- package/project/.sdk/tm/rb/test/primary_utility_test.rb +174 -560
- package/project/.sdk/tm/rb/test/struct_utility_test.rb +13 -7
- package/project/.sdk/tm/rb/test/vendor/omni/runner.rb +493 -0
- package/project/.sdk/tm/rb/test/vendor/omni/util.rb +199 -0
- package/project/.sdk/tm/rb/test/vendor/omni/voxgig_omni.rb +15 -0
- package/project/.sdk/tm/rb/utility/prepare_method.rb +5 -1
- package/project/.sdk/tm/rust/tests/common/mod.rs +19 -242
- package/project/.sdk/tm/rust/tests/omni_resolver/mod.rs +888 -0
- package/project/.sdk/tm/rust/tests/omni_smoke_test.rs +286 -0
- package/project/.sdk/tm/rust/tests/primary_utility_test.rs +318 -312
- package/project/.sdk/tm/rust/tests/struct_utility_test.rs +66 -28
- package/project/.sdk/tm/rust/tests/vendor/omni/json.rs +412 -0
- package/project/.sdk/tm/rust/tests/vendor/omni/mod.rs +38 -0
- package/project/.sdk/tm/rust/tests/vendor/omni/regex.rs +392 -0
- package/project/.sdk/tm/rust/tests/vendor/omni/runner.rs +1001 -0
- package/project/.sdk/tm/rust/tests/vendor/omni/util.rs +161 -0
- package/project/.sdk/tm/rust/utility/prepare_method.rs +5 -1
- package/project/.sdk/tm/scala/Makefile +16 -6
- package/project/.sdk/tm/scala/sdktest/OmniResolver.scala +497 -0
- package/project/.sdk/tm/scala/sdktest/OmniSmoke.scala +192 -0
- package/project/.sdk/tm/scala/sdktest/PrimaryCorpus.scala +47 -19
- package/project/.sdk/tm/scala/sdktest/StructCorpus.scala +0 -0
- package/project/.sdk/tm/scala/sdktest/vendor/omni/Json.scala +229 -0
- package/project/.sdk/tm/scala/sdktest/vendor/omni/Runner.scala +552 -0
- package/project/.sdk/tm/scala/sdktest/vendor/omni/Util.scala +104 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/Struct/Constants.swift +10 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/Struct/Inject.swift +28 -5
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/Struct/Injection.swift +5 -1
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/Struct/Minor.swift +4 -1
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/Struct/Validate.swift +15 -5
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/utility/Prepare.swift +6 -1
- package/project/.sdk/tm/swift/Tests/ProjectNameSDKTests/OmniResolver.swift +474 -0
- package/project/.sdk/tm/swift/Tests/ProjectNameSDKTests/OmniSmokeTest.swift +107 -0
- package/project/.sdk/tm/swift/Tests/ProjectNameSDKTests/PrimaryUtilityTest.swift +141 -178
- package/project/.sdk/tm/swift/Tests/ProjectNameSDKTests/Runner.swift +17 -113
- package/project/.sdk/tm/swift/Tests/ProjectNameSDKTests/StructUtilityTest.swift +295 -446
- package/project/.sdk/tm/swift/Tests/vendor/omni/Json.swift +364 -0
- package/project/.sdk/tm/swift/Tests/vendor/omni/Runner.swift +730 -0
- package/project/.sdk/tm/swift/Tests/vendor/omni/Util.swift +162 -0
- package/project/.sdk/tm/ts/src/feature/secrets/SecretsFeature.ts +7 -0
- package/project/.sdk/tm/ts/src/feature/secrets/plugin/Capability.ts +148 -0
- package/project/.sdk/tm/ts/src/feature/secrets/plugin/Catalog.ts +55 -0
- package/project/.sdk/tm/ts/src/feature/secrets/plugin/Config.ts +344 -0
- package/project/.sdk/tm/ts/src/feature/secrets/plugin/Depend.ts +205 -0
- package/project/.sdk/tm/ts/src/feature/secrets/plugin/Env.ts +138 -0
- package/project/.sdk/tm/ts/src/feature/secrets/plugin/Export.ts +46 -0
- package/project/.sdk/tm/ts/src/feature/secrets/plugin/FeatureHost.ts +349 -0
- package/project/.sdk/tm/ts/src/feature/secrets/plugin/Graph.ts +181 -0
- package/project/.sdk/tm/ts/src/feature/secrets/plugin/Host.ts +1132 -0
- package/project/.sdk/tm/ts/src/feature/secrets/plugin/Order.ts +177 -0
- package/project/.sdk/tm/ts/src/feature/secrets/plugin/Point.ts +119 -0
- package/project/.sdk/tm/ts/src/feature/secrets/plugin/Ref.ts +102 -0
- package/project/.sdk/tm/ts/src/feature/secrets/plugin/Resolve.ts +61 -0
- package/project/.sdk/tm/ts/src/feature/secrets/plugin/Types.ts +112 -0
- package/project/.sdk/tm/ts/src/feature/secrets/plugin/Version.ts +100 -0
- package/project/.sdk/tm/ts/src/feature/secrets/plugin/index.ts +37 -0
- package/project/.sdk/tm/ts/src/feature/secrets/sekreto/Sekreto.ts +163 -30
- package/project/.sdk/tm/ts/src/feature/secrets/sekreto/index.ts +27 -22
- package/project/.sdk/tm/ts/src/feature/secrets/sekreto/{provider → plugins}/aws.ts +26 -36
- package/project/.sdk/tm/ts/src/feature/secrets/sekreto/{provider → plugins}/azuresecrets.ts +19 -21
- package/project/.sdk/tm/ts/src/feature/secrets/sekreto/{provider → plugins}/boru.ts +36 -17
- package/project/.sdk/tm/ts/src/feature/secrets/sekreto/{provider → plugins}/doppler.ts +14 -21
- package/project/.sdk/tm/ts/src/feature/secrets/sekreto/{provider → plugins}/gcpsecrets.ts +27 -27
- package/project/.sdk/tm/ts/src/feature/secrets/sekreto/{provider → plugins}/hashicorp.ts +25 -39
- package/project/.sdk/tm/ts/src/feature/secrets/sekreto/plugins/httpjson.ts +99 -0
- package/project/.sdk/tm/ts/src/feature/secrets/sekreto/{provider → plugins}/infisical.ts +14 -16
- package/project/.sdk/tm/ts/src/feature/secrets/sekreto/{provider → plugins}/onepassword.ts +15 -22
- package/project/.sdk/tm/ts/src/feature/secrets/sekreto/plugins/secretspec.ts +98 -0
- package/project/.sdk/tm/ts/src/feature/secrets/sekreto/{Sigv4.ts → plugins/sigv4.ts} +7 -6
- package/project/.sdk/tm/ts/src/feature/secrets/sekreto/provider/addr.ts +97 -23
- package/project/.sdk/tm/ts/src/feature/secrets/sekreto/provider/builtin.ts +37 -0
- package/project/.sdk/tm/ts/src/feature/secrets/sekreto/provider/dotenv.ts +4 -17
- package/project/.sdk/tm/ts/src/feature/secrets/sekreto/provider/env.ts +4 -16
- package/project/.sdk/tm/ts/src/feature/secrets/sekreto/provider/file.ts +11 -25
- package/project/.sdk/tm/ts/src/feature/secrets/sekreto/provider/memory.ts +6 -23
- package/project/.sdk/tm/ts/src/feature/secrets/sekreto/provider/support.ts +106 -39
- package/project/.sdk/tm/ts/src/utility/StructUtility.ts +3 -3
- package/project/.sdk/tm/ts/test/omni.ts +104 -32
- package/project/.sdk/tm/ts/test/utility/StructUtility.test.ts +27 -0
- package/project/.sdk/tm/ts/test/vendor/omni/Runner.ts +32 -5
- package/project/.sdk/tm/ts/test/vendor/omni/Util.ts +2 -2
- package/project/.sdk/tm/ts/test/vendor/omni/index.ts +2 -2
- package/project/.sdk/tm/zig/test/primary_utility_test.zig +1 -1
- package/project/.sdk/tm/zig/test/struct_runner.zig +5 -4
- package/project/sdkgen-package.json +1 -1
- package/src/action/doctor.ts +66 -2
- package/src/helpers/naming.ts +4 -2
- package/project/.sdk/tm/c/tests/runner.h +0 -274
- package/project/.sdk/tm/cpp/test/struct_runner.hpp +0 -314
- package/project/.sdk/tm/csharp/test/StructRunner.cs +0 -276
- package/project/.sdk/tm/dart/test/runner.dart +0 -406
- package/project/.sdk/tm/dart/test/struct_corpus.dart +0 -531
- package/project/.sdk/tm/elixir/test/support/struct_corpus.ex +0 -1088
- package/project/.sdk/tm/go/test/runner_test.go +0 -629
- package/project/.sdk/tm/go/test/struct_runner_test.go +0 -1094
- package/project/.sdk/tm/java/test/StructRunner.java +0 -281
- package/project/.sdk/tm/js/test/runner.js +0 -387
- package/project/.sdk/tm/kotlin/test/StructRunner.kt +0 -177
- package/project/.sdk/tm/lua/test/struct_runner.lua +0 -602
- package/project/.sdk/tm/ocaml/test/corpus_runner.ml +0 -185
- package/project/.sdk/tm/perl/t/struct_runner.pm +0 -275
- package/project/.sdk/tm/php/test/StructRunner.php +0 -275
- package/project/.sdk/tm/py/test/struct_runner.py +0 -411
- package/project/.sdk/tm/rb/test/struct_runner.rb +0 -309
- package/project/.sdk/tm/rust/tests/struct_runner/mod.rs +0 -424
- package/project/.sdk/tm/ts/src/feature/secrets/sekreto/provider/Registry.ts +0 -90
- package/project/.sdk/tm/ts/src/feature/secrets/sekreto/provider/http.ts +0 -66
- package/project/.sdk/tm/ts/test/vendor/omni/compat.ts +0 -188
|
@@ -0,0 +1,940 @@
|
|
|
1
|
+
// VENDORED: @voxgig/omni sdk-20260904-1610-0 (c/src/runner.c)
|
|
2
|
+
// Source: https://github.com/voxgig/omni @ 8c3e1b573a8d35796f7fc45e3226b977023cabf7 [tag: sdk-20260904-1610-0]
|
|
3
|
+
// License: MIT (c) voxgig - see repository LICENSE. Do not edit: resync from upstream.
|
|
4
|
+
/* Omni: the shared multi-language test runner (C port).
|
|
5
|
+
*
|
|
6
|
+
* Port of the canonical TypeScript implementation
|
|
7
|
+
* (typescript/src/Runner.ts). Behaviour must match, case for case.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
#include <ctype.h>
|
|
11
|
+
#include <math.h>
|
|
12
|
+
#include <stdio.h>
|
|
13
|
+
#include <stdlib.h>
|
|
14
|
+
#include <string.h>
|
|
15
|
+
|
|
16
|
+
#include "omni.h"
|
|
17
|
+
|
|
18
|
+
struct omni_runner {
|
|
19
|
+
omni_pool *pool;
|
|
20
|
+
omni_json *alltests;
|
|
21
|
+
omni_provider *provider;
|
|
22
|
+
int specversion;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
struct omni_runpack {
|
|
26
|
+
omni_pool *pool;
|
|
27
|
+
omni_json *spec;
|
|
28
|
+
char *name;
|
|
29
|
+
omni_provider *provider;
|
|
30
|
+
omni_subject *subject;
|
|
31
|
+
int specversion;
|
|
32
|
+
|
|
33
|
+
char **clientnames;
|
|
34
|
+
omni_provider **clients;
|
|
35
|
+
size_t nclients;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
omni_flags omni_flags_default(void) {
|
|
39
|
+
omni_flags flags;
|
|
40
|
+
flags.null = 1;
|
|
41
|
+
flags.name = NULL;
|
|
42
|
+
return flags;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
omni_flags omni_flags_nonull(void) {
|
|
46
|
+
omni_flags flags;
|
|
47
|
+
flags.null = 0;
|
|
48
|
+
flags.name = NULL;
|
|
49
|
+
return flags;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/* ---- message building ---------------------------------------------- */
|
|
53
|
+
|
|
54
|
+
static char *omni_join(omni_pool *pool, const char *a, const char *b, const char *c,
|
|
55
|
+
const char *d) {
|
|
56
|
+
size_t len = 1;
|
|
57
|
+
char *out;
|
|
58
|
+
|
|
59
|
+
len += NULL == a ? 0 : strlen(a);
|
|
60
|
+
len += NULL == b ? 0 : strlen(b);
|
|
61
|
+
len += NULL == c ? 0 : strlen(c);
|
|
62
|
+
len += NULL == d ? 0 : strlen(d);
|
|
63
|
+
|
|
64
|
+
out = (char *)omni_pool_alloc(pool, len);
|
|
65
|
+
if (NULL == out) {
|
|
66
|
+
return NULL;
|
|
67
|
+
}
|
|
68
|
+
out[0] = '\0';
|
|
69
|
+
|
|
70
|
+
if (NULL != a) {
|
|
71
|
+
strcat(out, a);
|
|
72
|
+
}
|
|
73
|
+
if (NULL != b) {
|
|
74
|
+
strcat(out, b);
|
|
75
|
+
}
|
|
76
|
+
if (NULL != c) {
|
|
77
|
+
strcat(out, c);
|
|
78
|
+
}
|
|
79
|
+
if (NULL != d) {
|
|
80
|
+
strcat(out, d);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
return out;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/* The spec-defined part of an entry (drop runner bookkeeping). */
|
|
87
|
+
static omni_json *omni_entrysummary(omni_pool *pool, const omni_json *entry) {
|
|
88
|
+
omni_json *out;
|
|
89
|
+
size_t index;
|
|
90
|
+
|
|
91
|
+
if (!omni_ismap(entry)) {
|
|
92
|
+
return omni_clone(pool, entry);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
out = omni_map(pool);
|
|
96
|
+
for (index = 0; index < entry->maplen; index++) {
|
|
97
|
+
const char *key = entry->keys[index];
|
|
98
|
+
if (0 != strcmp(key, "res") && 0 != strcmp(key, "thrown") && 0 != strcmp(key, "ctx")) {
|
|
99
|
+
omni_map_set(out, key, omni_clone(pool, entry->vals[index]));
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
return out;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/* The label of one entry, for failure messages. */
|
|
107
|
+
static char *omni_entryref(omni_pool *pool, omni_flags flags, size_t index,
|
|
108
|
+
const omni_json *entry) {
|
|
109
|
+
char head[64];
|
|
110
|
+
const omni_json *id = omni_map_get(entry, "id");
|
|
111
|
+
const char *label = NULL == flags.name ? "set" : flags.name;
|
|
112
|
+
|
|
113
|
+
snprintf(head, sizeof(head), "[%lu]", (unsigned long)index);
|
|
114
|
+
|
|
115
|
+
if (omni_isabsent(id)) {
|
|
116
|
+
return omni_join(pool, label, head, NULL, NULL);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
return omni_join(pool, label, head, " (", omni_join(pool, omni_stringify(pool, id), ")", NULL, NULL));
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
static char *omni_fail(omni_pool *pool, omni_flags flags, size_t index, const omni_json *entry,
|
|
123
|
+
const char *reason, const char *expected, const char *actual) {
|
|
124
|
+
char *msg = omni_join(pool, "omni: ", omni_entryref(pool, flags, index, entry), ": ", reason);
|
|
125
|
+
|
|
126
|
+
if (NULL != expected) {
|
|
127
|
+
msg = omni_join(pool, msg, "\n expected: ", expected, NULL);
|
|
128
|
+
}
|
|
129
|
+
if (NULL != actual) {
|
|
130
|
+
msg = omni_join(pool, msg, "\n actual: ", actual, NULL);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
msg = omni_join(pool, msg, "\n entry: ",
|
|
134
|
+
omni_stringify(pool, omni_entrysummary(pool, entry)), NULL);
|
|
135
|
+
|
|
136
|
+
return msg;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/* ---- format version (DOCS.md 2.7) ----------------------------------- */
|
|
140
|
+
|
|
141
|
+
const char *const OMNI_CAPABILITIES[] = {NULL};
|
|
142
|
+
|
|
143
|
+
static int omni_capability_known(const char *cap) {
|
|
144
|
+
size_t index;
|
|
145
|
+
for (index = 0; NULL != OMNI_CAPABILITIES[index]; index++) {
|
|
146
|
+
if (0 == strcmp(OMNI_CAPABILITIES[index], cap)) {
|
|
147
|
+
return 1;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
return 0;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
/* Read the spec's format version from its optional top-level OMNI block,
|
|
154
|
+
* and refuse a spec this runner cannot faithfully run: a version newer
|
|
155
|
+
* than OMNI_SPECVERSION, or a required capability not in
|
|
156
|
+
* OMNI_CAPABILITIES. Returns the version (0 with no OMNI block) on
|
|
157
|
+
* success; returns -1 and sets *errout on failure. */
|
|
158
|
+
static int omni_resolveversion(omni_pool *pool, const omni_json *alltests, char **errout) {
|
|
159
|
+
omni_json *meta = omni_map_get(alltests, "OMNI");
|
|
160
|
+
omni_json *versionval;
|
|
161
|
+
omni_json *requires;
|
|
162
|
+
double rawversion;
|
|
163
|
+
size_t index;
|
|
164
|
+
|
|
165
|
+
if (omni_isabsent(meta)) {
|
|
166
|
+
return 0;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
if (!omni_ismap(meta)) {
|
|
170
|
+
*errout = omni_pool_strdup(pool, "omni: malformed OMNI version block");
|
|
171
|
+
return -1;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
versionval = omni_map_get(meta, "version");
|
|
175
|
+
if (!omni_isnum(versionval)) {
|
|
176
|
+
*errout = omni_pool_strdup(pool, "omni: malformed OMNI version block");
|
|
177
|
+
return -1;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
rawversion = omni_numval(versionval);
|
|
181
|
+
if (rawversion != floor(rawversion)) {
|
|
182
|
+
*errout = omni_pool_strdup(pool, "omni: malformed OMNI version block");
|
|
183
|
+
return -1;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
if (0 > rawversion || OMNI_SPECVERSION < rawversion) {
|
|
187
|
+
*errout = omni_join(pool, "omni: unsupported spec version: ", omni_numstr(pool, rawversion),
|
|
188
|
+
NULL, NULL);
|
|
189
|
+
return -1;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
requires = omni_map_get(meta, "requires");
|
|
193
|
+
if (!omni_isabsent(requires)) {
|
|
194
|
+
if (!omni_islist(requires)) {
|
|
195
|
+
*errout = omni_pool_strdup(pool, "omni: malformed OMNI requires list");
|
|
196
|
+
return -1;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
for (index = 0; index < requires->listlen; index++) {
|
|
200
|
+
omni_json *cap = requires->list[index];
|
|
201
|
+
const char *capstr = omni_strval(cap);
|
|
202
|
+
|
|
203
|
+
if (NULL == capstr || !omni_capability_known(capstr)) {
|
|
204
|
+
*errout = omni_join(pool, "omni: spec requires unsupported capability: ",
|
|
205
|
+
omni_stringify(pool, cap), NULL, NULL);
|
|
206
|
+
return -1;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
return (int)rawversion;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
/* The complete set of fields an entry may carry. Under version 1 anything
|
|
215
|
+
* else is an error: an unrecognised key is almost always a typo'd
|
|
216
|
+
* assertion, and a typo'd assertion is a test that silently stopped
|
|
217
|
+
* testing. */
|
|
218
|
+
static const char *const omni_entryfields[] = {
|
|
219
|
+
"in", "args", "ctx", "out", "err", "match", "client", "id", "doc", NULL};
|
|
220
|
+
|
|
221
|
+
static int omni_entryfield_known(const char *key) {
|
|
222
|
+
size_t index;
|
|
223
|
+
for (index = 0; NULL != omni_entryfields[index]; index++) {
|
|
224
|
+
if (0 == strcmp(omni_entryfields[index], key)) {
|
|
225
|
+
return 1;
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
return 0;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
/* Strict entry validation, applied when the spec declares version 1 or
|
|
232
|
+
* later. The lenient format converts each of these mistakes into a
|
|
233
|
+
* silent pass or a dead field; here they fail with the entry named. */
|
|
234
|
+
static int omni_checkentry(omni_pool *pool, omni_flags flags, size_t index, const omni_json *entry,
|
|
235
|
+
char **errout) {
|
|
236
|
+
size_t at;
|
|
237
|
+
int argsources = 0;
|
|
238
|
+
omni_json *entryerr;
|
|
239
|
+
omni_json *entryid;
|
|
240
|
+
|
|
241
|
+
if (!omni_ismap(entry)) {
|
|
242
|
+
*errout = omni_fail(pool, flags, index, entry, "entry is not a map", NULL, NULL);
|
|
243
|
+
return 1;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
for (at = 0; at < entry->maplen; at++) {
|
|
247
|
+
if (!omni_entryfield_known(entry->keys[at])) {
|
|
248
|
+
*errout = omni_fail(
|
|
249
|
+
pool, flags, index, entry,
|
|
250
|
+
omni_join(pool, "unknown entry field: ", entry->keys[at], NULL, NULL), NULL, NULL);
|
|
251
|
+
return 1;
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
if (omni_map_has(entry, "in")) {
|
|
256
|
+
argsources++;
|
|
257
|
+
}
|
|
258
|
+
if (omni_map_has(entry, "args")) {
|
|
259
|
+
argsources++;
|
|
260
|
+
}
|
|
261
|
+
if (omni_map_has(entry, "ctx")) {
|
|
262
|
+
argsources++;
|
|
263
|
+
}
|
|
264
|
+
if (1 < argsources) {
|
|
265
|
+
*errout = omni_fail(pool, flags, index, entry, "entry has more than one of in, args, ctx",
|
|
266
|
+
NULL, NULL);
|
|
267
|
+
return 1;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
entryerr = omni_map_get(entry, "err");
|
|
271
|
+
if (!omni_isnone(entryerr) && omni_map_has(entry, "out")) {
|
|
272
|
+
*errout = omni_fail(pool, flags, index, entry, "entry has both err and out", NULL, NULL);
|
|
273
|
+
return 1;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
/* Presence, not definedness: a genuinely absent id is fine (the runner
|
|
277
|
+
* assigns none), but a present `id: null` is malformed - it must fail
|
|
278
|
+
* here rather than being silently accepted as "no id". */
|
|
279
|
+
entryid = omni_map_get(entry, "id");
|
|
280
|
+
if (!omni_isabsent(entryid) && !omni_isstr(entryid)) {
|
|
281
|
+
*errout = omni_fail(pool, flags, index, entry, "entry id is not a string", NULL, NULL);
|
|
282
|
+
return 1;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
return 0;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
/* Validate a version-1 group up front, against the AUTHORED entries (the
|
|
289
|
+
* un-normalised `testspec`, not the fixjson-normalised `normalset`) -
|
|
290
|
+
* otherwise null-normalisation would rewrite an authored null (e.g.
|
|
291
|
+
* id: null) into the NULLMARK sentinel string and hide it from
|
|
292
|
+
* validation entirely. A malformed spec is a spec error, not a test
|
|
293
|
+
* result, so it is checked in full before any subject runs. Absorbs the
|
|
294
|
+
* empty-set check too, since that also belongs to the authored group. */
|
|
295
|
+
static int omni_checkset(omni_pool *pool, omni_flags flags, const omni_json *testspec,
|
|
296
|
+
omni_json *normalset, char **errout) {
|
|
297
|
+
omni_json *origsetraw = omni_map_get(testspec, "set");
|
|
298
|
+
omni_json *origset = omni_islist(origsetraw) ? origsetraw : normalset;
|
|
299
|
+
omni_json *emptyflag = omni_map_get(testspec, "empty");
|
|
300
|
+
int marked = !omni_isabsent(emptyflag) && OMNI_BOOL == emptyflag->type && emptyflag->boolval;
|
|
301
|
+
size_t index;
|
|
302
|
+
|
|
303
|
+
if (0 == origset->listlen && !marked) {
|
|
304
|
+
*errout = omni_join(pool, "omni: empty test set: ", flags.name, NULL, NULL);
|
|
305
|
+
return 1;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
for (index = 0; index < origset->listlen; index++) {
|
|
309
|
+
if (0 != omni_checkentry(pool, flags, index, origset->list[index], errout)) {
|
|
310
|
+
return 1;
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
return 0;
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
/* ---- spec resolution ----------------------------------------------- */
|
|
318
|
+
|
|
319
|
+
omni_json *omni_resolvespec(const char *name, omni_json *alltests) {
|
|
320
|
+
omni_json *primary;
|
|
321
|
+
omni_json *section;
|
|
322
|
+
|
|
323
|
+
if (NULL == name || '\0' == name[0]) {
|
|
324
|
+
return alltests;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
primary = omni_map_get(alltests, "primary");
|
|
328
|
+
if (omni_ismap(primary)) {
|
|
329
|
+
section = omni_map_get(primary, name);
|
|
330
|
+
if (!omni_isabsent(section)) {
|
|
331
|
+
return section;
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
section = omni_map_get(alltests, name);
|
|
336
|
+
if (!omni_isabsent(section)) {
|
|
337
|
+
return section;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
return alltests;
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
static omni_subject *omni_resolvesubject(const char *name, omni_provider *provider) {
|
|
344
|
+
if (NULL == name || '\0' == name[0] || NULL == provider || NULL == provider->subject) {
|
|
345
|
+
return NULL;
|
|
346
|
+
}
|
|
347
|
+
return provider->subject(provider, name);
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
/* ---- value normalisation ------------------------------------------- */
|
|
351
|
+
|
|
352
|
+
static omni_json *omni_fixjson(omni_pool *pool, const omni_json *val, int donull) {
|
|
353
|
+
size_t index;
|
|
354
|
+
|
|
355
|
+
/* Canonical returns the value UNCHANGED when donull is false
|
|
356
|
+
(typescript/src/Runner.ts): `undefined` stays undefined and `null` stays
|
|
357
|
+
null. Answering null for both collapsed two states the corpus
|
|
358
|
+
distinguishes, so a subject that returned nothing could not be told from
|
|
359
|
+
one that returned null. Same defect omni-lua and omni-rust carried
|
|
360
|
+
(voxgig/omni#17, #23). Still a fresh node, as the contract says. */
|
|
361
|
+
if (omni_isabsent(val) || omni_isnull(val)) {
|
|
362
|
+
if (donull) {
|
|
363
|
+
return omni_str(pool, OMNI_NULLMARK);
|
|
364
|
+
}
|
|
365
|
+
return omni_isabsent(val) ? omni_absent(pool) : omni_null(pool);
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
if (omni_islist(val)) {
|
|
369
|
+
omni_json *out = omni_list(pool);
|
|
370
|
+
for (index = 0; index < val->listlen; index++) {
|
|
371
|
+
omni_list_push(out, omni_fixjson(pool, val->list[index], donull));
|
|
372
|
+
}
|
|
373
|
+
return out;
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
if (omni_ismap(val)) {
|
|
377
|
+
omni_json *out = omni_map(pool);
|
|
378
|
+
for (index = 0; index < val->maplen; index++) {
|
|
379
|
+
omni_map_set(out, val->keys[index], omni_fixjson(pool, val->vals[index], donull));
|
|
380
|
+
}
|
|
381
|
+
return out;
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
return omni_clone(pool, val);
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
/* The JSON form of an error: always at least {name,message}. */
|
|
388
|
+
static omni_json *omni_errify(omni_pool *pool, const char *message) {
|
|
389
|
+
omni_json *out = omni_map(pool);
|
|
390
|
+
omni_map_set(out, "name", omni_str(pool, "Error"));
|
|
391
|
+
omni_map_set(out, "message", omni_str(pool, NULL == message ? "" : message));
|
|
392
|
+
return out;
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
/* ---- matching ------------------------------------------------------ */
|
|
396
|
+
|
|
397
|
+
static int omni_strcasefind(const char *haystack, const char *needle) {
|
|
398
|
+
size_t hlen = strlen(haystack);
|
|
399
|
+
size_t nlen = strlen(needle);
|
|
400
|
+
size_t at;
|
|
401
|
+
size_t index;
|
|
402
|
+
|
|
403
|
+
if (0 == nlen) {
|
|
404
|
+
return 1;
|
|
405
|
+
}
|
|
406
|
+
if (nlen > hlen) {
|
|
407
|
+
return 0;
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
for (at = 0; at + nlen <= hlen; at++) {
|
|
411
|
+
for (index = 0; index < nlen; index++) {
|
|
412
|
+
int a = tolower((unsigned char)haystack[at + index]);
|
|
413
|
+
int b = tolower((unsigned char)needle[index]);
|
|
414
|
+
if (a != b) {
|
|
415
|
+
break;
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
if (index == nlen) {
|
|
419
|
+
return 1;
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
return 0;
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
int omni_matchval(omni_pool *pool, const omni_json *check, const omni_json *base) {
|
|
427
|
+
const char *want;
|
|
428
|
+
|
|
429
|
+
if (omni_deepequal(check, base)) {
|
|
430
|
+
return 1;
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
want = omni_strval(check);
|
|
434
|
+
|
|
435
|
+
if (NULL != want && (0 == strcmp(want, OMNI_UNDEFMARK) || 0 == strcmp(want, OMNI_NULLMARK))) {
|
|
436
|
+
const char *basestr = omni_strval(base);
|
|
437
|
+
return omni_isnone(base) || (NULL != basestr && 0 == strcmp(basestr, OMNI_NULLMARK));
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
if (omni_isnone(check)) {
|
|
441
|
+
const char *basestr = omni_strval(base);
|
|
442
|
+
return omni_isnone(base) || (NULL != basestr && 0 == strcmp(basestr, OMNI_NULLMARK));
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
if (NULL != want) {
|
|
446
|
+
char *basestr = omni_stringify(pool, base);
|
|
447
|
+
size_t wantlen = strlen(want);
|
|
448
|
+
|
|
449
|
+
/* An empty want is a substring of everything, so it would match any
|
|
450
|
+
* value. Require the base to be the empty string too. */
|
|
451
|
+
if (0 == wantlen) {
|
|
452
|
+
const char *bstr = omni_strval(base);
|
|
453
|
+
return NULL != bstr && '\0' == bstr[0];
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
if (2 < wantlen && '/' == want[0] && '/' == want[wantlen - 1]) {
|
|
457
|
+
char *pattern = omni_pool_strdup(pool, want + 1);
|
|
458
|
+
pattern[wantlen - 2] = '\0';
|
|
459
|
+
return omni_regex_find(pattern, basestr);
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
return omni_strcasefind(basestr, want);
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
return 0;
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
typedef struct {
|
|
469
|
+
omni_pool *pool;
|
|
470
|
+
omni_flags flags;
|
|
471
|
+
size_t index;
|
|
472
|
+
const omni_json *entry;
|
|
473
|
+
const omni_json *base;
|
|
474
|
+
char **errout;
|
|
475
|
+
} omni_matchctx;
|
|
476
|
+
|
|
477
|
+
static char *omni_matchat(omni_matchctx *ctx, char **path, size_t pathlen) {
|
|
478
|
+
return 0 == pathlen ? omni_pool_strdup(ctx->pool, "<root>")
|
|
479
|
+
: omni_pathify(ctx->pool, path, pathlen);
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
static int omni_matchwalk(omni_matchctx *ctx, const omni_json *check, char **path,
|
|
483
|
+
size_t pathlen) {
|
|
484
|
+
size_t at;
|
|
485
|
+
char part[32];
|
|
486
|
+
|
|
487
|
+
if (omni_islist(check)) {
|
|
488
|
+
for (at = 0; at < check->listlen; at++) {
|
|
489
|
+
snprintf(part, sizeof(part), "%lu", (unsigned long)at);
|
|
490
|
+
path[pathlen] = omni_pool_strdup(ctx->pool, part);
|
|
491
|
+
if (0 != omni_matchwalk(ctx, check->list[at], path, pathlen + 1)) {
|
|
492
|
+
return 1;
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
return 0;
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
if (omni_ismap(check)) {
|
|
499
|
+
for (at = 0; at < check->maplen; at++) {
|
|
500
|
+
path[pathlen] = check->keys[at];
|
|
501
|
+
if (0 != omni_matchwalk(ctx, check->vals[at], path, pathlen + 1)) {
|
|
502
|
+
return 1;
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
return 0;
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
{
|
|
509
|
+
const omni_json *baseval = omni_getpath(ctx->base, path, pathlen);
|
|
510
|
+
const char *checkstr = omni_strval(check);
|
|
511
|
+
const char *basestr = omni_strval(baseval);
|
|
512
|
+
|
|
513
|
+
/* The sentinels are tested BEFORE the identity check below. Otherwise
|
|
514
|
+
* a subject returning the literal string "__UNDEF__" satisfies an
|
|
515
|
+
* assertion that the key is absent - two mutually exclusive states
|
|
516
|
+
* passing one check. A sentinel that accepts its own literal is not a
|
|
517
|
+
* sentinel. (NULLMARK still accepts NULLMARK: under the default null
|
|
518
|
+
* flag a real null has already been normalised to it, so the two are
|
|
519
|
+
* genuinely indistinguishable here - that one needs a raw-value
|
|
520
|
+
* escape, not an ordering change.) */
|
|
521
|
+
|
|
522
|
+
/* Explicitly absent: satisfied only by a genuinely missing key, never
|
|
523
|
+
* by a present null (the distinction the sentinels exist to keep). */
|
|
524
|
+
if (NULL != checkstr && 0 == strcmp(checkstr, OMNI_UNDEFMARK)) {
|
|
525
|
+
if (omni_isabsent(baseval)) {
|
|
526
|
+
return 0;
|
|
527
|
+
}
|
|
528
|
+
*ctx->errout = omni_fail(
|
|
529
|
+
ctx->pool, ctx->flags, ctx->index, ctx->entry,
|
|
530
|
+
omni_join(ctx->pool, "expected absent at ", omni_matchat(ctx, path, pathlen), NULL, NULL),
|
|
531
|
+
"absent", omni_stringify(ctx->pool, baseval));
|
|
532
|
+
return 1;
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
/* Explicitly null: satisfied only by a present null. */
|
|
536
|
+
if (NULL != checkstr && 0 == strcmp(checkstr, OMNI_NULLMARK)) {
|
|
537
|
+
if (omni_isnull(baseval) || (NULL != basestr && 0 == strcmp(basestr, OMNI_NULLMARK))) {
|
|
538
|
+
return 0;
|
|
539
|
+
}
|
|
540
|
+
*ctx->errout = omni_fail(
|
|
541
|
+
ctx->pool, ctx->flags, ctx->index, ctx->entry,
|
|
542
|
+
omni_join(ctx->pool, "expected null at ", omni_matchat(ctx, path, pathlen), NULL, NULL),
|
|
543
|
+
"null", omni_stringify(ctx->pool, baseval));
|
|
544
|
+
return 1;
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
/* Explicitly present: any present value, including null. */
|
|
548
|
+
if (NULL != checkstr && 0 == strcmp(checkstr, OMNI_EXISTSMARK)) {
|
|
549
|
+
if (!omni_isabsent(baseval)) {
|
|
550
|
+
return 0;
|
|
551
|
+
}
|
|
552
|
+
*ctx->errout = omni_fail(
|
|
553
|
+
ctx->pool, ctx->flags, ctx->index, ctx->entry,
|
|
554
|
+
omni_join(ctx->pool, "expected present at ", omni_matchat(ctx, path, pathlen), NULL, NULL),
|
|
555
|
+
"present", "absent");
|
|
556
|
+
return 1;
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
/* Identical values match. This sits below the sentinel branches on
|
|
560
|
+
* purpose - see the note above. */
|
|
561
|
+
if (omni_deepequal(check, baseval)) {
|
|
562
|
+
return 0;
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
/* A concrete expectation never matches a missing key - a match leaf
|
|
566
|
+
* against an absent value must fail, not substring-match "undefined". */
|
|
567
|
+
if (omni_isabsent(baseval)) {
|
|
568
|
+
*ctx->errout = omni_fail(
|
|
569
|
+
ctx->pool, ctx->flags, ctx->index, ctx->entry,
|
|
570
|
+
omni_join(ctx->pool, "match failed at ", omni_matchat(ctx, path, pathlen), NULL, NULL),
|
|
571
|
+
omni_stringify(ctx->pool, check), "absent");
|
|
572
|
+
return 1;
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
if (omni_matchval(ctx->pool, check, baseval)) {
|
|
576
|
+
return 0;
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
*ctx->errout = omni_fail(
|
|
580
|
+
ctx->pool, ctx->flags, ctx->index, ctx->entry,
|
|
581
|
+
omni_join(ctx->pool, "match failed at ", omni_matchat(ctx, path, pathlen), NULL, NULL),
|
|
582
|
+
omni_stringify(ctx->pool, check), omni_stringify(ctx->pool, baseval));
|
|
583
|
+
return 1;
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
#define OMNI_MAXPATH 64
|
|
588
|
+
|
|
589
|
+
static int omni_match(omni_pool *pool, omni_flags flags, size_t index, const omni_json *entry,
|
|
590
|
+
const omni_json *check, const omni_json *base, char **errout) {
|
|
591
|
+
omni_matchctx ctx;
|
|
592
|
+
char *path[OMNI_MAXPATH];
|
|
593
|
+
|
|
594
|
+
ctx.pool = pool;
|
|
595
|
+
ctx.flags = flags;
|
|
596
|
+
ctx.index = index;
|
|
597
|
+
ctx.entry = entry;
|
|
598
|
+
ctx.base = base;
|
|
599
|
+
ctx.errout = errout;
|
|
600
|
+
|
|
601
|
+
return omni_matchwalk(&ctx, check, path, 0);
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
/* ---- result checking ----------------------------------------------- */
|
|
605
|
+
|
|
606
|
+
static int omni_checkresult(omni_pool *pool, omni_flags flags, size_t index, omni_json *entry,
|
|
607
|
+
omni_json *args, omni_json *res, char **errout) {
|
|
608
|
+
int matched = 0;
|
|
609
|
+
omni_json *entryerr = omni_map_get(entry, "err");
|
|
610
|
+
omni_json *check = omni_map_get(entry, "match");
|
|
611
|
+
omni_json *out;
|
|
612
|
+
|
|
613
|
+
if (!omni_isnone(entryerr)) {
|
|
614
|
+
*errout = omni_fail(pool, flags, index, entry, "expected error did not occur",
|
|
615
|
+
omni_stringify(pool, entryerr), omni_stringify(pool, res));
|
|
616
|
+
return 1;
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
if (!omni_isnone(check)) {
|
|
620
|
+
omni_json *base = omni_map(pool);
|
|
621
|
+
omni_map_set(base, "in", omni_map_get(entry, "in"));
|
|
622
|
+
omni_map_set(base, "args", args);
|
|
623
|
+
omni_map_set(base, "out", omni_map_get(entry, "res"));
|
|
624
|
+
omni_map_set(base, "ctx", omni_map_get(entry, "ctx"));
|
|
625
|
+
|
|
626
|
+
if (0 != omni_match(pool, flags, index, entry, check, base, errout)) {
|
|
627
|
+
return 1;
|
|
628
|
+
}
|
|
629
|
+
matched = 1;
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
out = omni_map_get(entry, "out");
|
|
633
|
+
|
|
634
|
+
if (omni_deepequal(res, out)) {
|
|
635
|
+
return 0;
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
/* NOTE: a match with no explicit out is a complete check on its own. */
|
|
639
|
+
if (matched) {
|
|
640
|
+
const char *outstr = omni_strval(out);
|
|
641
|
+
if (omni_isnone(out) || (NULL != outstr && 0 == strcmp(outstr, OMNI_NULLMARK))) {
|
|
642
|
+
return 0;
|
|
643
|
+
}
|
|
644
|
+
}
|
|
645
|
+
|
|
646
|
+
*errout = omni_fail(pool, flags, index, entry, "result mismatch", omni_stringify(pool, out),
|
|
647
|
+
omni_stringify(pool, res));
|
|
648
|
+
return 1;
|
|
649
|
+
}
|
|
650
|
+
|
|
651
|
+
/* The error base a `match.err` sees: the provider's own, when it has one. */
|
|
652
|
+
static omni_json *omni_errbase(omni_pool *pool, const char *message,
|
|
653
|
+
omni_provider *provider) {
|
|
654
|
+
if (NULL != provider && NULL != provider->errify) {
|
|
655
|
+
return provider->errify(provider, pool, message);
|
|
656
|
+
}
|
|
657
|
+
return omni_errify(pool, message);
|
|
658
|
+
}
|
|
659
|
+
|
|
660
|
+
static int omni_handleerror(omni_pool *pool, omni_flags flags, size_t index, omni_json *entry,
|
|
661
|
+
const char *message, omni_provider *provider, char **errout) {
|
|
662
|
+
omni_json *entryerr = omni_map_get(entry, "err");
|
|
663
|
+
omni_json *check;
|
|
664
|
+
|
|
665
|
+
if (!omni_isnone(entryerr)) {
|
|
666
|
+
int istrue = (NULL != entryerr && OMNI_BOOL == entryerr->type && entryerr->boolval);
|
|
667
|
+
omni_json *msgval = omni_str(pool, message);
|
|
668
|
+
|
|
669
|
+
if (istrue || omni_matchval(pool, entryerr, msgval)) {
|
|
670
|
+
check = omni_map_get(entry, "match");
|
|
671
|
+
if (!omni_isnone(check)) {
|
|
672
|
+
omni_json *base = omni_map(pool);
|
|
673
|
+
omni_map_set(base, "in", omni_map_get(entry, "in"));
|
|
674
|
+
omni_map_set(base, "out", omni_map_get(entry, "res"));
|
|
675
|
+
omni_map_set(base, "ctx", omni_map_get(entry, "ctx"));
|
|
676
|
+
omni_map_set(base, "err", omni_errbase(pool, message, provider));
|
|
677
|
+
return omni_match(pool, flags, index, entry, check, base, errout);
|
|
678
|
+
}
|
|
679
|
+
return 0;
|
|
680
|
+
}
|
|
681
|
+
|
|
682
|
+
*errout = omni_fail(pool, flags, index, entry, "error mismatch",
|
|
683
|
+
omni_stringify(pool, entryerr), message);
|
|
684
|
+
return 1;
|
|
685
|
+
}
|
|
686
|
+
|
|
687
|
+
*errout = omni_fail(pool, flags, index, entry, "unexpected error", NULL, message);
|
|
688
|
+
return 1;
|
|
689
|
+
}
|
|
690
|
+
|
|
691
|
+
/* ---- runner -------------------------------------------------------- */
|
|
692
|
+
|
|
693
|
+
omni_json *omni_loadspec(omni_pool *pool, const char *path, char **errout) {
|
|
694
|
+
char *text;
|
|
695
|
+
char *parseerr = NULL;
|
|
696
|
+
omni_json *alltests;
|
|
697
|
+
|
|
698
|
+
if (NULL != errout) {
|
|
699
|
+
*errout = NULL;
|
|
700
|
+
}
|
|
701
|
+
|
|
702
|
+
text = omni_readfile(pool, path);
|
|
703
|
+
if (NULL == text) {
|
|
704
|
+
if (NULL != errout) {
|
|
705
|
+
*errout = omni_join(pool, "omni: cannot read spec: ", path, NULL, NULL);
|
|
706
|
+
}
|
|
707
|
+
return NULL;
|
|
708
|
+
}
|
|
709
|
+
|
|
710
|
+
alltests = omni_parse(pool, text, &parseerr);
|
|
711
|
+
if (NULL == alltests && NULL != errout) {
|
|
712
|
+
*errout = omni_join(pool, "omni: cannot parse spec: ", path, ": ", parseerr);
|
|
713
|
+
}
|
|
714
|
+
|
|
715
|
+
return alltests;
|
|
716
|
+
}
|
|
717
|
+
|
|
718
|
+
omni_runner *omni_make_runner(omni_pool *pool, const char *path, omni_json *spec,
|
|
719
|
+
omni_provider *provider, char **errout) {
|
|
720
|
+
omni_runner *runner;
|
|
721
|
+
omni_json *alltests = spec;
|
|
722
|
+
int specversion;
|
|
723
|
+
|
|
724
|
+
if (NULL != errout) {
|
|
725
|
+
*errout = NULL;
|
|
726
|
+
}
|
|
727
|
+
|
|
728
|
+
if (NULL == alltests) {
|
|
729
|
+
if (NULL == path) {
|
|
730
|
+
if (NULL != errout) {
|
|
731
|
+
*errout = omni_pool_strdup(pool, "omni: no spec given");
|
|
732
|
+
}
|
|
733
|
+
return NULL;
|
|
734
|
+
}
|
|
735
|
+
|
|
736
|
+
alltests = omni_loadspec(pool, path, errout);
|
|
737
|
+
if (NULL == alltests) {
|
|
738
|
+
return NULL;
|
|
739
|
+
}
|
|
740
|
+
}
|
|
741
|
+
|
|
742
|
+
/* Fail fast: a spec this runner cannot faithfully run is refused before
|
|
743
|
+
* any test group runs, not partway through the first one. */
|
|
744
|
+
specversion = omni_resolveversion(pool, alltests, errout);
|
|
745
|
+
if (0 > specversion) {
|
|
746
|
+
return NULL;
|
|
747
|
+
}
|
|
748
|
+
|
|
749
|
+
runner = (omni_runner *)omni_pool_alloc(pool, sizeof(omni_runner));
|
|
750
|
+
runner->pool = pool;
|
|
751
|
+
runner->alltests = alltests;
|
|
752
|
+
runner->provider = provider;
|
|
753
|
+
runner->specversion = specversion;
|
|
754
|
+
|
|
755
|
+
return runner;
|
|
756
|
+
}
|
|
757
|
+
|
|
758
|
+
omni_runpack *omni_runner_run(omni_runner *runner, const char *name, omni_json *store,
|
|
759
|
+
char **errout) {
|
|
760
|
+
omni_runpack *pack;
|
|
761
|
+
omni_json *defclient;
|
|
762
|
+
|
|
763
|
+
(void)store;
|
|
764
|
+
|
|
765
|
+
if (NULL != errout) {
|
|
766
|
+
*errout = NULL;
|
|
767
|
+
}
|
|
768
|
+
|
|
769
|
+
pack = (omni_runpack *)omni_pool_alloc(runner->pool, sizeof(omni_runpack));
|
|
770
|
+
pack->pool = runner->pool;
|
|
771
|
+
pack->name = omni_pool_strdup(runner->pool, NULL == name ? "" : name);
|
|
772
|
+
pack->spec = omni_resolvespec(name, runner->alltests);
|
|
773
|
+
pack->provider = runner->provider;
|
|
774
|
+
pack->subject = omni_resolvesubject(name, runner->provider);
|
|
775
|
+
pack->specversion = runner->specversion;
|
|
776
|
+
|
|
777
|
+
/* Build the named clients declared by the spec's DEF.client block. A
|
|
778
|
+
* spec may define clients that a given test run never references. */
|
|
779
|
+
defclient = omni_map_get(omni_map_get(pack->spec, "DEF"), "client");
|
|
780
|
+
|
|
781
|
+
if (omni_ismap(defclient) && NULL != runner->provider && NULL != runner->provider->client) {
|
|
782
|
+
size_t index;
|
|
783
|
+
|
|
784
|
+
pack->nclients = defclient->maplen;
|
|
785
|
+
pack->clientnames = (char **)omni_pool_alloc(runner->pool, sizeof(char *) * (pack->nclients + 1));
|
|
786
|
+
pack->clients =
|
|
787
|
+
(omni_provider **)omni_pool_alloc(runner->pool, sizeof(omni_provider *) * (pack->nclients + 1));
|
|
788
|
+
|
|
789
|
+
for (index = 0; index < defclient->maplen; index++) {
|
|
790
|
+
omni_json *cdef = defclient->vals[index];
|
|
791
|
+
omni_json *copts = omni_map_get(omni_map_get(cdef, "test"), "options");
|
|
792
|
+
|
|
793
|
+
if (omni_isabsent(copts)) {
|
|
794
|
+
copts = omni_map(runner->pool);
|
|
795
|
+
}
|
|
796
|
+
|
|
797
|
+
pack->clientnames[index] = defclient->keys[index];
|
|
798
|
+
pack->clients[index] = runner->provider->client(runner->provider, copts);
|
|
799
|
+
}
|
|
800
|
+
}
|
|
801
|
+
|
|
802
|
+
return pack;
|
|
803
|
+
}
|
|
804
|
+
|
|
805
|
+
omni_json *omni_spec(omni_runpack *pack) { return pack->spec; }
|
|
806
|
+
|
|
807
|
+
omni_json *omni_set(omni_runpack *pack, const char *name) {
|
|
808
|
+
return omni_map_get(pack->spec, name);
|
|
809
|
+
}
|
|
810
|
+
|
|
811
|
+
int omni_runset(omni_runpack *pack, omni_json *testspec, omni_subject *subject, char **errout) {
|
|
812
|
+
return omni_runsetflags(pack, testspec, omni_flags_default(), subject, errout);
|
|
813
|
+
}
|
|
814
|
+
|
|
815
|
+
int omni_runsetflags(omni_runpack *pack, omni_json *testspec, omni_flags flags,
|
|
816
|
+
omni_subject *subject, char **errout) {
|
|
817
|
+
omni_pool *pool = pack->pool;
|
|
818
|
+
omni_json *testspecmap;
|
|
819
|
+
omni_json *testset;
|
|
820
|
+
omni_subject *usesubject = NULL == subject ? pack->subject : subject;
|
|
821
|
+
size_t index;
|
|
822
|
+
|
|
823
|
+
if (NULL != errout) {
|
|
824
|
+
*errout = NULL;
|
|
825
|
+
}
|
|
826
|
+
|
|
827
|
+
if (NULL == flags.name) {
|
|
828
|
+
flags.name = ('\0' == pack->name[0]) ? "set" : pack->name;
|
|
829
|
+
}
|
|
830
|
+
|
|
831
|
+
if (NULL == usesubject) {
|
|
832
|
+
*errout = omni_join(pool, "omni: no test subject for: ", flags.name, NULL, NULL);
|
|
833
|
+
return 1;
|
|
834
|
+
}
|
|
835
|
+
|
|
836
|
+
testspecmap = omni_fixjson(pool, testspec, flags.null);
|
|
837
|
+
testset = omni_map_get(testspecmap, "set");
|
|
838
|
+
|
|
839
|
+
if (!omni_islist(testset)) {
|
|
840
|
+
*errout = omni_join(pool, "omni: test spec has no set: ", flags.name, NULL, NULL);
|
|
841
|
+
return 1;
|
|
842
|
+
}
|
|
843
|
+
|
|
844
|
+
/* Validate the AUTHORED group up front, against testspec (pre-fixjson),
|
|
845
|
+
* not testset (post-fixjson) - see omni_checkset. Absorbs the
|
|
846
|
+
* empty-set check: a vacuously green group proves nothing, so version
|
|
847
|
+
* 1 makes an empty set an error unless the group is marked empty. */
|
|
848
|
+
if (1 <= pack->specversion) {
|
|
849
|
+
if (0 != omni_checkset(pool, flags, testspec, testset, errout)) {
|
|
850
|
+
return 1;
|
|
851
|
+
}
|
|
852
|
+
}
|
|
853
|
+
|
|
854
|
+
for (index = 0; index < testset->listlen; index++) {
|
|
855
|
+
omni_json *entry = testset->list[index];
|
|
856
|
+
omni_json *args = omni_list(pool);
|
|
857
|
+
omni_subject *entrysubject = usesubject;
|
|
858
|
+
omni_provider *entryprovider = pack->provider;
|
|
859
|
+
omni_json *clientname;
|
|
860
|
+
omni_json *rawargs;
|
|
861
|
+
omni_result result;
|
|
862
|
+
size_t at;
|
|
863
|
+
|
|
864
|
+
/* An entry with no `out` expects a null (or absent) result. */
|
|
865
|
+
if (flags.null && omni_isnone(omni_map_get(entry, "out"))) {
|
|
866
|
+
omni_map_set(entry, "out", omni_str(pool, OMNI_NULLMARK));
|
|
867
|
+
}
|
|
868
|
+
|
|
869
|
+
clientname = omni_map_get(entry, "client");
|
|
870
|
+
if (omni_isstr(clientname)) {
|
|
871
|
+
omni_provider *client = NULL;
|
|
872
|
+
for (at = 0; at < pack->nclients; at++) {
|
|
873
|
+
if (0 == strcmp(pack->clientnames[at], omni_strval(clientname))) {
|
|
874
|
+
client = pack->clients[at];
|
|
875
|
+
break;
|
|
876
|
+
}
|
|
877
|
+
}
|
|
878
|
+
|
|
879
|
+
if (NULL == client) {
|
|
880
|
+
*errout = omni_join(pool, "omni: unknown client: ", omni_strval(clientname), NULL, NULL);
|
|
881
|
+
return 1;
|
|
882
|
+
}
|
|
883
|
+
|
|
884
|
+
entryprovider = client;
|
|
885
|
+
{
|
|
886
|
+
omni_subject *clientsubject = omni_resolvesubject(pack->name, client);
|
|
887
|
+
if (NULL != clientsubject) {
|
|
888
|
+
entrysubject = clientsubject;
|
|
889
|
+
}
|
|
890
|
+
}
|
|
891
|
+
}
|
|
892
|
+
|
|
893
|
+
/* Build the argument list: `ctx`, `args`, or `in`. */
|
|
894
|
+
rawargs = omni_map_get(entry, "args");
|
|
895
|
+
if (omni_map_has(entry, "ctx")) {
|
|
896
|
+
omni_list_push(args, omni_map_get(entry, "ctx"));
|
|
897
|
+
} else if (omni_islist(rawargs)) {
|
|
898
|
+
for (at = 0; at < rawargs->listlen; at++) {
|
|
899
|
+
omni_list_push(args, rawargs->list[at]);
|
|
900
|
+
}
|
|
901
|
+
} else {
|
|
902
|
+
omni_list_push(args, omni_clone(pool, omni_map_get(entry, "in")));
|
|
903
|
+
}
|
|
904
|
+
|
|
905
|
+
if ((omni_map_has(entry, "ctx") || omni_map_has(entry, "args")) && 0 < args->listlen &&
|
|
906
|
+
omni_ismap(args->list[0])) {
|
|
907
|
+
omni_json *first = omni_clone(pool, args->list[0]);
|
|
908
|
+
if (NULL != pack->provider && NULL != pack->provider->contextify) {
|
|
909
|
+
first = pack->provider->contextify(pack->provider, first);
|
|
910
|
+
}
|
|
911
|
+
args->list[0] = first;
|
|
912
|
+
omni_map_set(entry, "ctx", first);
|
|
913
|
+
|
|
914
|
+
/* So a subject can reach the client it was invoked through. */
|
|
915
|
+
if (omni_ismap(first)) {
|
|
916
|
+
first->client = entryprovider;
|
|
917
|
+
}
|
|
918
|
+
}
|
|
919
|
+
|
|
920
|
+
result = entrysubject->call(entrysubject, args->list, args->listlen);
|
|
921
|
+
|
|
922
|
+
if (NULL != result.err) {
|
|
923
|
+
if (0 != omni_handleerror(pool, flags, index, entry, result.err, pack->provider, errout)) {
|
|
924
|
+
return 1;
|
|
925
|
+
}
|
|
926
|
+
continue;
|
|
927
|
+
}
|
|
928
|
+
|
|
929
|
+
{
|
|
930
|
+
omni_json *res = omni_fixjson(pool, result.val, flags.null);
|
|
931
|
+
omni_map_set(entry, "res", res);
|
|
932
|
+
|
|
933
|
+
if (0 != omni_checkresult(pool, flags, index, entry, args, res, errout)) {
|
|
934
|
+
return 1;
|
|
935
|
+
}
|
|
936
|
+
}
|
|
937
|
+
}
|
|
938
|
+
|
|
939
|
+
return 0;
|
|
940
|
+
}
|