swiftwasm / swift

WebAssembly support for the Swift programming language
https://swiftwasm.org
1.29k stars 28 forks source link

Fix compile error on test cases depending on platform #29

Closed kateinoigakukun closed 9 months ago

kateinoigakukun commented 4 years ago

Now, failing over 400 test cases https://gist.githack.com/kateinoigakukun/4967df0206477c913b7997862689a1b5/raw/319552867efc78d246432c72413b40eaf53d42f7/index.html

``` Swift(wasi-wasm32) :: ClangImporter/cfuncs_parse.swift Swift(wasi-wasm32) :: ClangImporter/clang-function-types.swift Swift(wasi-wasm32) :: ClangImporter/cstring_parse.swift Swift(wasi-wasm32) :: ClangImporter/ctypes_parse.swift Swift(wasi-wasm32) :: ClangImporter/ctypes_parse_bitfields.swift Swift(wasi-wasm32) :: ClangImporter/ctypes_parse_swift4.swift Swift(wasi-wasm32) :: ClangImporter/ctypes_parse_union.swift Swift(wasi-wasm32) :: ClangImporter/cvars_parse.swift Swift(wasi-wasm32) :: ClangImporter/cxx_interop.swift Swift(wasi-wasm32) :: ClangImporter/cxx_interop_ir.swift Swift(wasi-wasm32) :: ClangImporter/enum-cxx.swift Swift(wasi-wasm32) :: ClangImporter/inlinable_bitfields.swift Swift(wasi-wasm32) :: ClangImporter/long-long-promotion.swift Swift(wasi-wasm32) :: ClangImporter/macro_literals.swift Swift(wasi-wasm32) :: ClangImporter/mapped-integers.swift.gyb Swift(wasi-wasm32) :: ClangImporter/simd.swift Swift(wasi-wasm32) :: ClangImporter/submodules.swift Swift(wasi-wasm32) :: ClangImporter/submodules_scoped.swift Swift(wasi-wasm32) :: ClangImporter/unserializable-clang-function-types.swift Swift(wasi-wasm32) :: Constraints/function_builder.swift Swift(wasi-wasm32) :: DebugInfo/Errors.swift Swift(wasi-wasm32) :: DebugInfo/variables.swift Swift(wasi-wasm32) :: DebuggerTestingTransform/basic-assignments.swift Swift(wasi-wasm32) :: Driver/SourceRanges/range-incremental-no-build-record.swift Swift(wasi-wasm32) :: Driver/SourceRanges/range-lifecycle.swift Swift(wasi-wasm32) :: Driver/autolink-force-load-comdat.swift Swift(wasi-wasm32) :: Driver/batch_mode_dependencies_make_wrong_order.swift Swift(wasi-wasm32) :: Driver/driver_mode.swift Swift(wasi-wasm32) :: Driver/embed-bitcode.swift Swift(wasi-wasm32) :: Driver/linker.swift Swift(wasi-wasm32) :: Driver/lock_interface.swift Swift(wasi-wasm32) :: Driver/multi-threaded.swift Swift(wasi-wasm32) :: Driver/opt-record.swift Swift(wasi-wasm32) :: Driver/opt-remark.swift Swift(wasi-wasm32) :: Driver/options.swift Swift(wasi-wasm32) :: Driver/profiling.swift Swift(wasi-wasm32) :: Driver/response-file.swift Swift(wasi-wasm32) :: Driver/sdk.swift Swift(wasi-wasm32) :: Driver/unknown-inputs.swift Swift(wasi-wasm32) :: Frontend/crash-in-user-code.swift Swift(wasi-wasm32) :: Frontend/type-fingerprint.swift Swift(wasi-wasm32) :: IDE/complete_cache.swift Swift(wasi-wasm32) :: IDE/complete_from_clang_importer_framework.swift Swift(wasi-wasm32) :: IDE/module_api_smoketest.swift Swift(wasi-wasm32) :: IRGen/access_markers.sil Swift(wasi-wasm32) :: IRGen/address_sanitizer_recover.swift Swift(wasi-wasm32) :: IRGen/asan-attributes.swift Swift(wasi-wasm32) :: IRGen/big_types_corner_cases.swift Swift(wasi-wasm32) :: IRGen/c_layout.sil Swift(wasi-wasm32) :: IRGen/errors.sil Swift(wasi-wasm32) :: IRGen/module_hash.swift Swift(wasi-wasm32) :: IRGen/objc_simd.sil Swift(wasi-wasm32) :: IRGen/pic.swift Swift(wasi-wasm32) :: IRGen/prespecialized-metadata/enum-inmodule-evolution-1argument-1distinct_use-external_resilient-nonfrozen.swift Swift(wasi-wasm32) :: IRGen/protocol_conformance_records.swift Swift(wasi-wasm32) :: IRGen/protocol_resilience.sil Swift(wasi-wasm32) :: IRGen/report_dead_method_call.swift Swift(wasi-wasm32) :: IRGen/sanitize_coverage.swift Swift(wasi-wasm32) :: Interpreter/arrays.swift Swift(wasi-wasm32) :: Interpreter/dynamicReplacement_property_observer.swift Swift(wasi-wasm32) :: Interpreter/dynamic_replacement.swift Swift(wasi-wasm32) :: Interpreter/dynamic_replacement_chaining.swift Swift(wasi-wasm32) :: Interpreter/dynamic_replacement_without_previous_calls.swift Swift(wasi-wasm32) :: Interpreter/enforce_exclusive_access.swift Swift(wasi-wasm32) :: Interpreter/enum-nonexhaustivity.swift Swift(wasi-wasm32) :: Interpreter/enum.swift Swift(wasi-wasm32) :: Interpreter/error_self_conformance.swift Swift(wasi-wasm32) :: Interpreter/external_key_path_ref.swift Swift(wasi-wasm32) :: Interpreter/keypath.swift Swift(wasi-wasm32) :: Interpreter/polymorphic_builtins.swift Swift(wasi-wasm32) :: Interpreter/property_wrappers.swift Swift(wasi-wasm32) :: Interpreter/switch_resilience.swift Swift(wasi-wasm32) :: Interpreter/testable_key_path.swift Swift(wasi-wasm32) :: Interpreter/tuple_casts.swift Swift(wasi-wasm32) :: Interpreter/unresolvable_dynamic_metadata_cycles.swift Swift(wasi-wasm32) :: Interpreter/withoutActuallyEscaping.swift Swift(wasi-wasm32) :: Misc/stats_dir_plausible_maxrss.swift Swift(wasi-wasm32) :: Misc/stats_dir_profiler.swift Swift(wasi-wasm32) :: Misc/stats_dir_tracer.swift Swift(wasi-wasm32) :: ModuleInterface/ModuleCache/SDKDependencies-disable-validation.swift Swift(wasi-wasm32) :: ModuleInterface/ModuleCache/SDKDependencies.swift Swift(wasi-wasm32) :: ModuleInterface/ModuleCache/SystemDependencies.swiftinterface Swift(wasi-wasm32) :: ModuleInterface/ModuleCache/forwarding-module-dependencies.swift Swift(wasi-wasm32) :: ModuleInterface/SmokeTest.swiftinterface Swift(wasi-wasm32) :: ModuleInterface/linking-to-module.swift Swift(wasi-wasm32) :: ModuleInterface/stored-properties-client.swift Swift(wasi-wasm32) :: ModuleInterface/swift_build_sdk_interfaces/track-system-dependencies.swift Swift(wasi-wasm32) :: Prototypes/Result.swift Swift(wasi-wasm32) :: Reflection/capture_descriptors.sil Swift(wasi-wasm32) :: Reflection/typeref_decoding.swift Swift(wasi-wasm32) :: Reflection/typeref_decoding_imported.swift Swift(wasi-wasm32) :: Reflection/typeref_lowering.swift Swift(wasi-wasm32) :: Runtime/backtrace.swift Swift(wasi-wasm32) :: Runtime/demangleToMetadata.swift Swift(wasi-wasm32) :: SIL/Parser/unnamed_struct_identifiers.sil Swift(wasi-wasm32) :: SIL/whole_module_optimization.swift Swift(wasi-wasm32) :: SILGen/auto_closures.swift Swift(wasi-wasm32) :: SILGen/closure_script_global_escape.swift Swift(wasi-wasm32) :: SILGen/closures.swift Swift(wasi-wasm32) :: SILGen/closures_callee_guaranteed.swift Swift(wasi-wasm32) :: SILGen/decls.swift Swift(wasi-wasm32) :: SILGen/erasure_reabstraction.swift Swift(wasi-wasm32) :: SILGen/function_conversion.swift Swift(wasi-wasm32) :: SILGen/generic_closures.swift Swift(wasi-wasm32) :: SILGen/implicitly_unwrapped_optional.swift Swift(wasi-wasm32) :: SILGen/property_abstraction.swift Swift(wasi-wasm32) :: SILGen/reabstract-tuple.swift Swift(wasi-wasm32) :: SILGen/reabstract.swift Swift(wasi-wasm32) :: SILGen/reabstract_lvalue.swift Swift(wasi-wasm32) :: SILGen/rethrows.swift Swift(wasi-wasm32) :: SILGen/switch_abstraction.swift Swift(wasi-wasm32) :: SILOptimizer/closure_lifetime_fixup.swift Swift(wasi-wasm32) :: SILOptimizer/closure_spec_and_inline.swift Swift(wasi-wasm32) :: SILOptimizer/cross-module-optimization.swift Swift(wasi-wasm32) :: SILOptimizer/predictable_memopt_unreferenceable_storage.swift Swift(wasi-wasm32) :: SILOptimizer/sil_combine1.swift Swift(wasi-wasm32) :: SILOptimizer/specialize_opaque_type_archetypes.swift Swift(wasi-wasm32) :: SILOptimizer/specialize_partial_apply.swift Swift(wasi-wasm32) :: Sema/clang_types_in_ast.swift Swift(wasi-wasm32) :: Serialization/android-modules.swift Swift(wasi-wasm32) :: Serialization/clang-function-types.swift Swift(wasi-wasm32) :: attr/attr_implements_fp.swift Swift(wasi-wasm32) :: multifile/resilient-module.swift Swift(wasi-wasm32) :: multifile/resilient-witness.swift Swift(wasi-wasm32) :: stdlib/Error.swift Swift(wasi-wasm32) :: stdlib/InputStream.swift.gyb Swift(wasi-wasm32) :: stdlib/Mirror.swift Swift(wasi-wasm32) :: stdlib/NumericParsing.swift.gyb Swift(wasi-wasm32) :: stdlib/Runtime.swift.gyb Swift(wasi-wasm32) :: stdlib/StringAPI.swift Swift(wasi-wasm32) :: stdlib/VarArgs.swift ```

Tips

To execute a single test case, run-test is very useful.

$ ./utils/run-test --build-dir ../build/Ninja-ReleaseAssert test/Runtime/foo.swift
Vercantez commented 4 years ago

Hi! I'm interested in contributing to this project. I'm gonna take a look at this since it's been marked as a good first issue

Vercantez commented 4 years ago

Is there an existing guide for building/testing the runtime for wasm? Or is it pretty much the same as x86_64?

kateinoigakukun commented 4 years ago

@Vercantez Thank you for interest! Almost same as other platforms, but there are some differences.

To prepare your development environment, please execute ./utils/webassembly/ci-linux.sh or ./utils/webassembly/ci-mac.sh. It installs some dependencies and builds this project.

The above ci-mac.sh script takes long time, so please use utils/webassembly/build-mac.sh instead from the second time.

utils/webassembly/build-mac.sh is just a wrapper of utils/build-script and you can pass some additional flags to build-mac.sh like

$ ./utils/webassembly/build-mac.sh --release -t --debug-swift-stdlib

When you want to run a test case, you can use utils/run-test to test it rapidly.

$ ./utils/run-test --build-dir ../build/Ninja-ReleaseAssert+stdlib-DebugAssert/ --target wasi-wasm32 test/stdlib/Result.swift
Vercantez commented 4 years ago

Awesome! Thanks so much

kateinoigakukun commented 4 years ago

Not failing cases are around 200 with -Onone! https://gistcdn.githack.com/kateinoigakukun/bb91a7cebda629fbe8b06cd2697b86d7/raw/c08ac2c2aaccd5295e5e025fa867be576d86125f/index.html

kateinoigakukun commented 9 months ago

Now we are running stdlib tests on CI