43static constexpr const char*
kNone =
"No Test or Benchmarks";
44static constexpr const char*
kList =
"List all Tests and Benchmarks";
88 "Usage: one of the following\n"
89 " run_vm_tests --list\n"
90 " run_vm_tests [--dfe=<snapshot file name>] --benchmarks\n"
91 " run_vm_tests [--dfe=<snapshot file name>] [vm-flags ...] <test name>\n"
92 " run_vm_tests [--dfe=<snapshot file name>] [vm-flags ...] <benchmark "
96#define CHECK_RESULT(result) \
97 if (Dart_IsError(result)) { \
98 *error = Utils::StrDup(Dart_GetError(result)); \
100 Dart_ShutdownIsolate(); \
105 const char* packages_config,
113 if ((strcmp(
run_filter,
"DartAPI_InvokeVMServiceMethod") != 0) &&
114 (strcmp(
run_filter,
"DartAPI_InvokeVMServiceMethod_Loop") != 0)) {
118 ASSERT(script_uri !=
nullptr);
121 script_uri, packages_config,
nullptr,
124 const uint8_t* kernel_buffer =
nullptr;
125 intptr_t kernel_buffer_size = 0;
131 flags->load_vmservice_library =
true;
132 flags->is_service_isolate =
true;
133 isolate_group_data->SetKernelBufferUnowned(
134 const_cast<uint8_t*
>(kernel_buffer), kernel_buffer_size);
137 kernel_buffer_size,
flags, isolate_group_data,
nullptr,
139 if (isolate ==
nullptr) {
140 delete isolate_group_data;
172 const char* package_root,
173 const char* packages_config,
177 ASSERT(script_uri !=
nullptr);
178 ASSERT(package_root ==
nullptr);
183 const bool is_kernel_isolate =
185 if (!is_kernel_isolate) {
187 "Spawning of only Kernel isolate is supported in run_vm_tests.");
192 const uint8_t* kernel_service_buffer =
nullptr;
193 intptr_t kernel_service_buffer_size = 0;
202 ASSERT(app_snapshot !=
nullptr);
203 const uint8_t* ignore_vm_snapshot_data;
204 const uint8_t* ignore_vm_snapshot_instructions;
208 &ignore_vm_snapshot_data, &ignore_vm_snapshot_instructions,
211 script_uri, packages_config, app_snapshot, app_snapshot !=
nullptr);
215 isolate_group_data,
nullptr,
error);
216 if (*
error !=
nullptr) {
225 if (isolate ==
nullptr) {
226 delete isolate_group_data;
230 if (isolate ==
nullptr) {
231 delete isolate_group_data;
232 isolate_group_data =
nullptr;
236 &kernel_service_buffer_size);
237 ASSERT(kernel_service_buffer !=
nullptr);
241 const_cast<uint8_t*
>(kernel_service_buffer),
242 kernel_service_buffer_size);
244 script_uri,
main, kernel_service_buffer, kernel_service_buffer_size,
247 if (isolate ==
nullptr) {
248 delete isolate_group_data;
260 if (kernel_service_buffer !=
nullptr) {
262 kernel_service_buffer_size);
269 if (*
error !=
nullptr) {
286 info->name =
"Run VM Tests";
292 for (intptr_t
i = 1;
i < *argc - 1;
i++) {
295 argv[*argc - 1] =
nullptr;
300#if !defined(DART_HOST_OS_WINDOWS)
307 const char** dart_argv =
nullptr;
327 if (argc == 2 && strcmp(
argv[1],
"--list") == 0) {
338 bool start_kernel_isolate =
false;
339 bool suppress_core_dump =
false;
340 if (strcmp(
argv[arg_pos],
"--suppress-core-dump") == 0) {
341 suppress_core_dump =
true;
345 if (suppress_core_dump) {
351 if (strncmp(
argv[arg_pos],
"--dfe", strlen(
"--dfe")) == 0) {
352 const char* delim = strstr(
argv[arg_pos],
"=");
353 if (delim ==
nullptr || strlen(delim + 1) == 0) {
359 start_kernel_isolate =
true;
363 if (arg_pos == argc - 1 && strcmp(
argv[arg_pos],
"--benchmarks") == 0) {
371 dart_argc = argc - 2;
372 dart_argv = &
argv[1];
380 if (
error !=
nullptr) {
393 memset(&init_params, 0,
sizeof(init_params));
404#if defined(DART_HOST_OS_FUCHSIA)
405 init_params.vmex_resource = dart::bin::Platform::GetVMEXResource();
408 if (
error !=
nullptr) {
423 if (
error !=
nullptr) {
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
#define RELEASE_ASSERT(cond)
const char * name() const
const char * score_kind() const
static void RunAll(const char *executable)
static char * Init(const Dart_InitializeParams *params)
void static bool failed()
static char * ProcessCommandLineFlags(int argc, const char **argv)
static void static void PrintErr(const char *format,...) PRINTF_ATTRIBUTE(1
static void PrintErr(const char *format,...) PRINTF_ATTRIBUTE(1
static void Print(const char *format,...) PRINTF_ATTRIBUTE(1
const char * expectation() const
const char * name() const
static Dart_IsolateGroupCreateCallback create_callback
static const char ** argv
static Dart_IsolateGroupCleanupCallback group_cleanup_callback
static const uint8_t * vm_snapshot_data
static char * StrDup(const char *s)
virtual void SetBuffers(const uint8_t **vm_data_buffer, const uint8_t **vm_instructions_buffer, const uint8_t **isolate_data_buffer, const uint8_t **isolate_instructions_buffer)=0
void LoadPlatform(const uint8_t **kernel_buffer, intptr_t *kernel_buffer_size)
void LoadKernelService(const uint8_t **kernel_service_buffer, intptr_t *kernel_service_buffer_size)
static void ReadFile(uint8_t **data, intptr_t *file_len, void *stream)
static bool SetOriginalWorkingDirectory()
static Dart_Handle EnvironmentCallback(Dart_Handle name)
static Dart_Handle PrepareForScriptLoading(bool is_service_isolate, bool trace_loading)
static void CloseFile(void *stream)
static MagicNumber SniffForMagicNumber(const char *filename)
static void * OpenFile(const char *name, bool write)
static void WriteFile(const void *buffer, intptr_t num_bytes, void *stream)
static void LoadDartProfilerSymbols(const char *exepath)
void SetKernelBufferUnowned(uint8_t *buffer, intptr_t size)
static Dart_Handle LibraryTagHandler(Dart_LibraryTag tag, Dart_Handle library, Dart_Handle url)
static void GetRSSInformation(int64_t *max_rss, int64_t *current_rss)
static void TerminateExitCodeHandler()
static AppSnapshot * TryReadAppSnapshot(const char *script_uri, bool force_load_elf_from_memory=false, bool decode_uri=true)
static const char * GetErrorMessage()
static bool Setup(const char *server_ip, intptr_t server_port, bool dev_mode_server, bool auth_codes_disabled, const char *write_service_info_filename, bool trace_loading, bool deterministic, bool enable_service_port_fallback, bool wait_for_dds_to_advertise_service, bool serve_devtools, bool serve_observatory, bool print_dtd)
#define DART_INITIALIZE_PARAMS_CURRENT_VERSION
#define DART_KERNEL_ISOLATE_NAME
struct _Dart_Handle * Dart_Handle
struct _Dart_Isolate * Dart_Isolate
#define DART_VM_SERVICE_ISOLATE_NAME
FlutterSemanticsFlag flags
const uint8_t uint32_t uint32_t GError ** error
const uint8_t * isolate_snapshot_data
const uint8_t * vm_snapshot_data
const uint8_t * vm_snapshot_instructions
const uint8_t * core_isolate_snapshot_data
const uint8_t * core_isolate_snapshot_instructions
void InitializeCrashpadClient()
const uint8_t * isolate_snapshot_instructions
static Dart_Isolate CreateIsolateAndSetup(const char *script_uri, const char *main, const char *package_root, const char *packages_config, Dart_IsolateFlags *flags, void *data, char **error)
DART_EXPORT void Dart_EnterScope()
DART_EXPORT void Dart_EnterIsolate(Dart_Isolate isolate)
static constexpr const char * kNone
static void CleanupIsolateGroup(void *callback_data)
DART_EXPORT void Dart_SetEmbedderInformationCallback(Dart_EmbedderInformationCallback callback)
static const char * kernel_snapshot
static void EmbedderInformationCallback(Dart_EmbedderInformation *info)
static const char * run_filter
static constexpr const char * kAllBenchmarks
static int Main(int argc, const char **argv)
void ShiftArgs(int *argc, const char **argv)
DART_EXPORT void Dart_ExitIsolate()
DART_EXPORT char * Dart_IsolateMakeRunnable(Dart_Isolate isolate)
DART_EXPORT Dart_Isolate Dart_CreateIsolateGroup(const char *script_uri, const char *name, const uint8_t *snapshot_data, const uint8_t *snapshot_instructions, Dart_IsolateFlags *flags, void *isolate_group_data, void *isolate_data, char **error)
DART_EXPORT Dart_Isolate Dart_CreateIsolateGroupFromKernel(const char *script_uri, const char *name, const uint8_t *kernel_buffer, intptr_t kernel_buffer_size, Dart_IsolateFlags *flags, void *isolate_group_data, void *isolate_data, char **error)
DART_EXPORT Dart_Handle Dart_SetLibraryTagHandler(Dart_LibraryTagHandler handler)
DART_EXPORT void Dart_ExitScope()
DART_EXPORT Dart_Handle Dart_LoadScriptFromKernel(const uint8_t *buffer, intptr_t buffer_size)
DART_EXPORT Dart_Handle Dart_SetEnvironmentCallback(Dart_EnvironmentCallback callback)
static int8_t data[kExtLength]
static Dart_Isolate CreateAndSetupServiceIsolate(const char *script_uri, const char *packages_config, Dart_IsolateFlags *flags, char **error)
DART_EXPORT void Dart_ShutdownIsolate()
static constexpr const char * kList
#define CHECK_RESULT(result)
const uint8_t kDartVmSnapshotData[]
const uint8_t kDartVmSnapshotInstructions[]
int main(int argc, const char **argv)
const uint8_t kDartCoreIsolateSnapshotInstructions[]
const uint8_t kDartCoreIsolateSnapshotData[]
Dart_IsolateGroupCreateCallback create_group
Dart_IsolateGroupCleanupCallback cleanup_group
Dart_FileReadCallback file_read
const uint8_t * vm_snapshot_data
bool start_kernel_isolate
Dart_FileOpenCallback file_open
Dart_FileWriteCallback file_write
const uint8_t * vm_snapshot_instructions
Dart_FileCloseCallback file_close