[WebAssembly] Test the "wasm32-wasi" triple

Add triple tests for "wasm32-wasi" and "wasm64-wasi", and also remove the
"-musl" component from the existing wasm triple tests as we're not using that
in practice (WASI libc is derived in part from musl, but it is not fully
musl-compatible).

Differential Revision: https://reviews.llvm.org/D61334

Reviewer: sbc100


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359629 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Dan Gohman 2019-04-30 23:04:49 +00:00
parent c049743f98
commit 15f67f93fc

View File

@ -252,11 +252,11 @@ TEST(TripleTest, ParsedIDs) {
EXPECT_EQ(Triple::UnknownOS, T.getOS());
EXPECT_EQ(Triple::UnknownEnvironment, T.getEnvironment());
T = Triple("wasm32-unknown-wasi-musl");
T = Triple("wasm32-unknown-wasi");
EXPECT_EQ(Triple::wasm32, T.getArch());
EXPECT_EQ(Triple::UnknownVendor, T.getVendor());
EXPECT_EQ(Triple::WASI, T.getOS());
EXPECT_EQ(Triple::Musl, T.getEnvironment());
EXPECT_EQ(Triple::UnknownEnvironment, T.getEnvironment());
T = Triple("wasm64-unknown-unknown");
EXPECT_EQ(Triple::wasm64, T.getArch());
@ -264,11 +264,11 @@ TEST(TripleTest, ParsedIDs) {
EXPECT_EQ(Triple::UnknownOS, T.getOS());
EXPECT_EQ(Triple::UnknownEnvironment, T.getEnvironment());
T = Triple("wasm64-unknown-wasi-musl");
T = Triple("wasm64-unknown-wasi");
EXPECT_EQ(Triple::wasm64, T.getArch());
EXPECT_EQ(Triple::UnknownVendor, T.getVendor());
EXPECT_EQ(Triple::WASI, T.getOS());
EXPECT_EQ(Triple::Musl, T.getEnvironment());
EXPECT_EQ(Triple::UnknownEnvironment, T.getEnvironment());
T = Triple("avr-unknown-unknown");
EXPECT_EQ(Triple::avr, T.getArch());
@ -702,6 +702,10 @@ TEST(TripleTest, Normalization) {
Triple::normalize("i686-linux")); // i686-pc-linux-gnu
EXPECT_EQ("arm-none-unknown-eabi",
Triple::normalize("arm-none-eabi")); // arm-none-eabi
EXPECT_EQ("wasm32-unknown-wasi",
Triple::normalize("wasm32-wasi")); // wasm32-unknown-wasi
EXPECT_EQ("wasm64-unknown-wasi",
Triple::normalize("wasm64-wasi")); // wasm64-unknown-wasi
}
TEST(TripleTest, MutateName) {
@ -1246,17 +1250,23 @@ TEST(TripleTest, FileFormat) {
EXPECT_EQ(Triple::Wasm, Triple("wasm32-unknown-unknown").getObjectFormat());
EXPECT_EQ(Triple::Wasm, Triple("wasm64-unknown-unknown").getObjectFormat());
EXPECT_EQ(Triple::Wasm, Triple("wasm32-unknown-wasi-musl").getObjectFormat());
EXPECT_EQ(Triple::Wasm, Triple("wasm64-unknown-wasi-musl").getObjectFormat());
EXPECT_EQ(Triple::Wasm, Triple("wasm32-wasi").getObjectFormat());
EXPECT_EQ(Triple::Wasm, Triple("wasm64-wasi").getObjectFormat());
EXPECT_EQ(Triple::Wasm, Triple("wasm32-unknown-wasi").getObjectFormat());
EXPECT_EQ(Triple::Wasm, Triple("wasm64-unknown-wasi").getObjectFormat());
EXPECT_EQ(Triple::Wasm,
Triple("wasm32-unknown-unknown-wasm").getObjectFormat());
EXPECT_EQ(Triple::Wasm,
Triple("wasm64-unknown-unknown-wasm").getObjectFormat());
EXPECT_EQ(Triple::Wasm,
Triple("wasm32-unknown-wasi-musl-wasm").getObjectFormat());
Triple("wasm32-wasi-wasm").getObjectFormat());
EXPECT_EQ(Triple::Wasm,
Triple("wasm64-unknown-wasi-musl-wasm").getObjectFormat());
Triple("wasm64-wasi-wasm").getObjectFormat());
EXPECT_EQ(Triple::Wasm,
Triple("wasm32-unknown-wasi-wasm").getObjectFormat());
EXPECT_EQ(Triple::Wasm,
Triple("wasm64-unknown-wasi-wasm").getObjectFormat());
EXPECT_EQ(Triple::XCOFF, Triple("powerpc-ibm-aix").getObjectFormat());
EXPECT_EQ(Triple::XCOFF, Triple("powerpc64-ibm-aix").getObjectFormat());