Skip to content

Fix test part 4 #451

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

Merged
2 changes: 1 addition & 1 deletion test/lit.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -1376,7 +1376,7 @@ elif run_os == 'wasi':
config.swift_test_options, config.swift_frontend_test_options)
subst_target_swift_frontend_mock_sdk = config.target_swift_frontend
subst_target_swift_frontend_mock_sdk_after = ""
config.target_run = 'wasmtime --'
config.target_run = 'wasmer run --'
if 'interpret' in lit_config.params:
use_interpreter_for_simple_runs()
config.target_sil_opt = (
Expand Down
4 changes: 4 additions & 0 deletions test/stdlib/Error.swift
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ ErrorTests.test("default domain and code") {

enum SillyError: Error { case JazzHands }

#if !os(WASI)
ErrorTests.test("try!")
.skip(.custom({ _isFastAssertConfiguration() },
reason: "trap is not guaranteed to happen in -Ounchecked"))
Expand All @@ -127,6 +128,7 @@ ErrorTests.test("try!/location")
expectCrashLater()
let _: () = try! { throw SillyError.JazzHands }()
}
#endif

ErrorTests.test("try?") {
var value = try? { () throws -> Int in return 1 }()
Expand Down Expand Up @@ -191,6 +193,7 @@ ErrorTests.test("test dealloc empty error box") {
}
}

#if !os(WASI)
var errors: [Error] = []
ErrorTests.test("willThrow") {
if #available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *) {
Expand All @@ -215,6 +218,7 @@ ErrorTests.test("willThrow") {
expectEqual(SillyError.self, type(of: errors.last!))
}
}
#endif

runAllTests()

4 changes: 2 additions & 2 deletions test/stdlib/Runtime.swift.gyb
Original file line number Diff line number Diff line change
Expand Up @@ -706,7 +706,7 @@ Reflection.test("multiprotocolTypes") {
var BitTwiddlingTestSuite = TestSuite("BitTwiddling")

BitTwiddlingTestSuite.test("_pointerSize") {
#if arch(i386) || arch(arm)
#if arch(i386) || arch(arm) || arch(wasm32)
expectEqual(4, MemoryLayout<Optional<AnyObject>>.size)
#elseif arch(x86_64) || arch(arm64) || arch(powerpc64) || arch(powerpc64le) || arch(s390x)
expectEqual(8, MemoryLayout<Optional<AnyObject>>.size)
Expand All @@ -730,7 +730,7 @@ BitTwiddlingTestSuite.test("_isPowerOf2/Int") {
expectTrue(_isPowerOf2(asInt(2)))
expectFalse(_isPowerOf2(asInt(3)))
expectTrue(_isPowerOf2(asInt(1024)))
#if arch(i386) || arch(arm)
#if arch(i386) || arch(arm) || arch(wasm32)
// Not applicable to 32-bit architectures.
#elseif arch(x86_64) || arch(arm64) || arch(powerpc64) || arch(powerpc64le) || arch(s390x)
expectTrue(_isPowerOf2(asInt(0x8000_0000)))
Expand Down
7 changes: 2 additions & 5 deletions utils/webassembly/linux/install-dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,9 @@ cd $SWIFT_PATH

./utils/update-checkout --clone --scheme wasm --skip-repository swift

# Install wasmtime
# Install wasmer

sudo mkdir /opt/wasmtime && cd /opt/wasmtime
wget -O - "https://github.com/bytecodealliance/wasmtime/releases/download/v0.8.0/wasmtime-v0.8.0-x86_64-linux.tar.xz" | \
sudo tar Jx --strip-components 1
sudo ln -sf /opt/wasmtime/* /usr/local/bin
curl https://get.wasmer.io -sSfL | sh

cd $SOURCE_PATH

Expand Down
9 changes: 1 addition & 8 deletions utils/webassembly/macos/install-dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,14 @@
set -ex

brew uninstall python@2 || true
brew install cmake ninja llvm sccache
brew install cmake ninja llvm sccache wasmer

SOURCE_PATH="$( cd "$(dirname $0)/../../../../" && pwd )"
SWIFT_PATH=$SOURCE_PATH/swift
cd $SWIFT_PATH

./utils/update-checkout --clone --scheme wasm --skip-repository swift

# Install wasmtime

sudo mkdir /opt/wasmtime && cd /opt/wasmtime
wget -O - "https://github.com/bytecodealliance/wasmtime/releases/download/v0.8.0/wasmtime-v0.8.0-x86_64-macos.tar.xz" | \
sudo tar Jx --strip-components 1
sudo ln -sf /opt/wasmtime/* /usr/local/bin

cd $SOURCE_PATH

wget -O dist-wasi-sdk.tgz.zip "https://github.com/swiftwasm/wasi-sdk/releases/download/0.2.0-swiftwasm/dist-macos-latest.tgz.zip"
Expand Down