Commit 1af723d5 authored by Almothana Athamneh's avatar Almothana Athamneh Committed by Commit Bot

[test] Use Fuchsia test runner for unittests

This CL attempts to run unittests on Fuchsia
using Infra

Bug: chromium:934932
Change-Id: I4b7cb740e17e65e91ca8c6ba6dfd07719e473e20
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1948709
Commit-Queue: Almothana Athamneh <almuthanna@chromium.org>
Reviewed-by: 's avatarMichael Achenbach <machenbach@chromium.org>
Cr-Commit-Position: refs/heads/master@{#65349}
parent 450dfc2b
......@@ -75,8 +75,12 @@
"label": "//test/unittests:unittests",
"type": "script",
},
"fuchsia-unittests": {
"label": "//test/unittests:unittests",
"type": "script",
},
"webkit": {
"label": "//test/webkit:v8_webkit",
"type": "script",
},
}
\ No newline at end of file
}
......@@ -53,7 +53,7 @@
'os': 'Ubuntu-16.04',
},
'tests': [
{'name': 'unittests'},
{'name': 'fuchsia-unittests'},
],
},
##############################################################################
......
......@@ -4,6 +4,22 @@
import("../../gni/v8.gni")
if (is_fuchsia) {
import("//build/config/fuchsia/rules.gni")
fuchsia_package("v8_unittests_pkg") {
testonly = true
binary = ":unittests"
package_name_override = "v8_unittests"
}
fuchsia_package_runner("v8_unittests_fuchsia") {
testonly = true
package = ":v8_unittests_pkg"
package_name_override = "v8_unittests"
}
}
v8_executable("unittests") {
testonly = true
......
......@@ -99,7 +99,10 @@ TEST(LanguageServerJson, TestJsonObjects) {
// issue with exceptions enabled for Torque.
// TODO(szuend): Remove the OS check when errors are reported differently,
// or the issue is resolved.
#if !defined(V8_OS_WIN)
// TODO(almuthanna): These tests were skipped because they cause a crash when
// they are ran on Fuchsia. This issue should be solved later on
// Ticket: https://crbug.com/1028617
#if !defined(V8_OS_WIN) && !defined(V8_TARGET_OS_FUCHSIA)
using ::testing::HasSubstr;
TEST(LanguageServerJson, ParserError) {
JsonParserResult result = ParseJson("{]");
......
......@@ -79,6 +79,10 @@ TEST(LanguageServer, GotoTypeDefinitionNoDataForFile) {
EXPECT_FALSE(LanguageServerData::FindDefinition(test_id, {0, 0}));
}
// TODO(almuthanna): This test was skipped because it causes a crash when it is
// ran on Fuchsia. This issue should be solved later on
// Ticket: https://crbug.com/1028617
#if !defined(V8_TARGET_OS_FUCHSIA)
TEST(LanguageServer, GotoLabelDefinitionInSignature) {
const std::string source =
"type void;\n"
......@@ -99,6 +103,7 @@ TEST(LanguageServer, GotoLabelDefinitionInSignature) {
ASSERT_TRUE(maybe_position.has_value());
EXPECT_EQ(*maybe_position, (SourcePosition{id, {5, 19}, {5, 26}}));
}
#endif
TEST(LanguageServer, GotoLabelDefinitionInTryBlock) {
const std::string source =
......@@ -122,6 +127,10 @@ TEST(LanguageServer, GotoLabelDefinitionInTryBlock) {
EXPECT_EQ(*maybe_position, (SourcePosition{id, {7, 8}, {7, 15}}));
}
// TODO(almuthanna): This test was skipped because it causes a crash when it is
// ran on Fuchsia. This issue should be solved later on
// Ticket: https://crbug.com/1028617
#if !defined(V8_TARGET_OS_FUCHSIA)
TEST(LanguageServer, GotoDefinitionClassSuperType) {
const std::string source =
"type void;\n"
......@@ -138,6 +147,7 @@ TEST(LanguageServer, GotoDefinitionClassSuperType) {
ASSERT_TRUE(maybe_position.has_value());
EXPECT_EQ(*maybe_position, (SourcePosition{id, {2, 5}, {2, 11}}));
}
#endif
TEST(LanguageServer, GotoLabelDefinitionInSignatureGotoStmt) {
const std::string source =
......
......@@ -124,6 +124,10 @@ void ExpectFailingCompilation(
source, MatcherVector<T>{{message_pattern, LineAndColumn::Invalid()}});
}
// TODO(almuthanna): the definition of this function is skipped on Fuchsia
// because it causes an 'unused function' exception upon buidling gn
// Ticket: https://crbug.com/1028617
#if !defined(V8_TARGET_OS_FUCHSIA)
int CountPreludeLines() {
static int result = -1;
if (result == -1) {
......@@ -132,17 +136,23 @@ int CountPreludeLines() {
}
return result;
}
#endif
using SubstrWithPosition =
std::pair<::testing::PolymorphicMatcher<
::testing::internal::HasSubstrMatcher<std::string>>,
LineAndColumn>;
// TODO(almuthanna): the definition of this function is skipped on Fuchsia
// because it causes an 'unused function' exception upon buidling gn
// Ticket: https://crbug.com/1028617
#if !defined(V8_TARGET_OS_FUCHSIA)
SubstrWithPosition SubstrTester(const std::string& message, int line, int col) {
// Change line and column from 1-based to 0-based.
return {::testing::HasSubstr(message),
LineAndColumn{line + CountPreludeLines() - 1, col - 1}};
}
#endif
using SubstrVector = std::vector<SubstrWithPosition>;
......@@ -234,6 +244,10 @@ TEST(Torque, TypeDeclarationOrder) {
)");
}
// TODO(almuthanna): These tests were skipped because they cause a crash when
// they are ran on Fuchsia. This issue should be solved later on
// Ticket: https://crbug.com/1028617
#if !defined(V8_TARGET_OS_FUCHSIA)
TEST(Torque, ConditionalFields) {
// This class should throw alignment errors if @if decorators aren't
// working.
......@@ -278,6 +292,7 @@ TEST(Torque, DoubleUnderScorePrefixIllegalForIdentifiers) {
)",
HasSubstr("Lexer Error"));
}
#endif
TEST(Torque, UnusedLetBindingLintError) {
ExpectFailingCompilation(R"(
......@@ -296,6 +311,10 @@ TEST(Torque, UnderscorePrefixSilencesUnusedWarning) {
)");
}
// TODO(almuthanna): This test was skipped because it causes a crash when it is
// ran on Fuchsia. This issue should be solved later on
// Ticket: https://crbug.com/1028617
#if !defined(V8_TARGET_OS_FUCHSIA)
TEST(Torque, UsingUnderscorePrefixedIdentifierError) {
ExpectFailingCompilation(R"(
@export macro Foo(y: Smi) {
......@@ -305,6 +324,7 @@ TEST(Torque, UsingUnderscorePrefixedIdentifierError) {
)",
HasSubstr("Trying to reference '_x'"));
}
#endif
TEST(Torque, UnusedArgumentLintError) {
ExpectFailingCompilation(R"(
......@@ -346,10 +366,15 @@ TEST(Torque, NoUnusedWarningForVariablesOnlyUsedInAsserts) {
)");
}
// TODO(almuthanna): This test was skipped because it causes a crash when it is
// ran on Fuchsia. This issue should be solved later on
// Ticket: https://crbug.com/1028617
#if !defined(V8_TARGET_OS_FUCHSIA)
TEST(Torque, ImportNonExistentFile) {
ExpectFailingCompilation(R"(import "foo/bar.tq")",
HasSubstr("File 'foo/bar.tq' not found."));
}
#endif
TEST(Torque, LetShouldBeConstLintError) {
ExpectFailingCompilation(R"(
......@@ -370,6 +395,10 @@ TEST(Torque, LetShouldBeConstIsSkippedForStructs) {
)");
}
// TODO(almuthanna): These tests were skipped because they cause a crash when
// they are ran on Fuchsia. This issue should be solved later on
// Ticket: https://crbug.com/1028617
#if !defined(V8_TARGET_OS_FUCHSIA)
TEST(Torque, GenericAbstractType) {
ExpectSuccessfulCompilation(R"(
type Foo<T: type> extends HeapObject;
......@@ -483,6 +512,7 @@ TEST(Torque, SpecializationRequesters) {
SubstrTester("Note: in specialization C<Smi> requested here", 11,
5)});
}
#endif
} // namespace torque
} // namespace internal
......
......@@ -110,6 +110,10 @@ sigjmp_buf MemoryAllocationPermissionsTest::continuation_;
} // namespace
// TODO(almuthanna): This test was skipped because it causes a crash when it is
// ran on Fuchsia. This issue should be solved later on
// Ticket: https://crbug.com/1028617
#if !defined(V8_TARGET_OS_FUCHSIA)
TEST_F(MemoryAllocationPermissionsTest, DoTest) {
TestPermissions(PageAllocator::Permission::kNoAccess, false, false);
TestPermissions(PageAllocator::Permission::kRead, true, false);
......@@ -117,6 +121,8 @@ TEST_F(MemoryAllocationPermissionsTest, DoTest) {
TestPermissions(PageAllocator::Permission::kReadWriteExecute, true, true);
TestPermissions(PageAllocator::Permission::kReadExecute, true, false);
}
#endif
#endif // V8_OS_POSIX
// Basic tests of allocation.
......
......@@ -260,6 +260,10 @@ class TrapHandlerTest : public TestWithIsolate,
std::unique_ptr<TestingAssemblerBuffer> recovery_buffer_;
};
// TODO(almuthanna): These tests were skipped because they cause a crash when
// they are ran on Fuchsia. This issue should be solved later on
// Ticket: https://crbug.com/1028617
#if !defined(V8_TARGET_OS_FUCHSIA)
TEST_P(TrapHandlerTest, TestTrapHandlerRecovery) {
// Test that the wasm trap handler can recover a memory access violation in
// wasm code (we fake the wasm code and the access violation).
......@@ -417,6 +421,7 @@ TEST_P(TrapHandlerTest, TestCrashInWasmWrongCrashType) {
*trap_handler::GetThreadInWasmThreadLocalAddress() = 0;
}
}
#endif
class CodeRunner : public v8::base::Thread {
public:
......@@ -430,6 +435,10 @@ class CodeRunner : public v8::base::Thread {
TestingAssemblerBuffer* buffer_;
};
// TODO(almuthanna): This test was skipped because it causes a crash when it is
// ran on Fuchsia. This issue should be solved later on
// Ticket: https://crbug.com/1028617
#if !defined(V8_TARGET_OS_FUCHSIA)
TEST_P(TrapHandlerTest, TestCrashInOtherThread) {
// Test setup:
// The current thread enters wasm land (sets the thread_in_wasm flag)
......@@ -464,6 +473,7 @@ TEST_P(TrapHandlerTest, TestCrashInOtherThread) {
// Reset the thread-in-wasm flag.
*trap_handler::GetThreadInWasmThreadLocalAddress() = 0;
}
#endif
INSTANTIATE_TEST_SUITE_P(Traps, TrapHandlerTest,
::testing::Values(kDefault, kCallback),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment