From a7fe1e6f55cf910871e65640a49fa1bd9af065e3 Mon Sep 17 00:00:00 2001 From: Ivan Inozemtsev Date: Tue, 24 Dec 2024 02:54:52 -0800 Subject: [PATCH] Embedder samples tests TEST=new test for ci Change-Id: I982583ef21c5907bde1dcbc1c34e57c2c0fae770 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/398902 Reviewed-by: Slava Egorov Commit-Queue: Ivan Inozemtsev --- BUILD.gn | 1 + runtime/bin/BUILD.gn | 14 +++++++++++++ runtime/tools/entitlements/run_kernel.plist | 10 +++++++++ tests/standalone/embedder_samples_test.dart | 23 +++++++++++++++++++++ 4 files changed, 48 insertions(+) create mode 100644 runtime/tools/entitlements/run_kernel.plist create mode 100644 tests/standalone/embedder_samples_test.dart diff --git a/BUILD.gn b/BUILD.gn index b3a28c4a6333..e3833e724d4a 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -52,6 +52,7 @@ group("runtime") { "runtime/bin:process_test", "runtime/bin:run_vm_tests", "runtime/vm:kernel_platform_files($host_toolchain)", + "samples/embedder:all", "samples/ffi/http:fake_http", "utils/dartdev:dartdev", "utils/kernel-service:kernel-service", diff --git a/runtime/bin/BUILD.gn b/runtime/bin/BUILD.gn index 447400fd52f4..d3c4e8d697aa 100644 --- a/runtime/bin/BUILD.gn +++ b/runtime/bin/BUILD.gn @@ -1203,6 +1203,20 @@ source_set("dart_embedder_runtime_jit_set") { ":libdart_builtin", "..:libdart_jit", ] + + if (is_win) { + libs = [ + # ole32.dll contains CoTaskMemAlloc. Here so that package:ffi can look + # CoTaskMemAlloc up with `DynamicLibrary.process()`. + "ole32.lib", + "iphlpapi.lib", + "psapi.lib", + "ws2_32.lib", + "Rpcrt4.lib", + "shlwapi.lib", + "winmm.lib", + ] + } } static_library("dart_embedder_runtime_jit") { diff --git a/runtime/tools/entitlements/run_kernel.plist b/runtime/tools/entitlements/run_kernel.plist new file mode 100644 index 000000000000..eeda4be95dc1 --- /dev/null +++ b/runtime/tools/entitlements/run_kernel.plist @@ -0,0 +1,10 @@ + + + + + com.apple.security.cs.allow-jit + + com.apple.security.cs.disable-library-validation + + + \ No newline at end of file diff --git a/tests/standalone/embedder_samples_test.dart b/tests/standalone/embedder_samples_test.dart new file mode 100644 index 000000000000..f7a396d45259 --- /dev/null +++ b/tests/standalone/embedder_samples_test.dart @@ -0,0 +1,23 @@ +import 'dart:io'; + +import 'package:expect/expect.dart'; + +void main() { + final executable = Platform.executable; + final outDir = executable.substring(0, executable.lastIndexOf('dart')); + + final runKernelExecutable = outDir + 'run_kernel'; + + final result = Process.runSync(runKernelExecutable, []); + Expect.equals( + 0, + result.exitCode, + 'process failed:\n' + ' exit code: ${result.exitCode}\n' + ' -- stdout --\n' + '${result.stdout}' + ' -- stderr --\n' + '${result.stderr}\n' + ' ------------', + ); +}