node icon indicating copy to clipboard operation
node copied to clipboard

test: add fast api tests for getLibuvNow()

Open anonrig opened this issue 1 year ago β€’ 11 comments

Adds a V8 fast api test for binding.getLibuvNow() function.

cc @nodejs/cpp-reviewers

anonrig avatar Nov 18 '24 15:11 anonrig

@targos I'm getting a runtime error with this. Am I missing something?

NOTE: The test started as a child_process using these flags: [ '--expose-internals', '--no-warnings', '--allow-natives-syntax' ] Use NODE_SKIP_FLAG_CHECK to run the test with the original flags.


#
# Fatal error in , line 0
# Check failed: v8_flags.fuzzing.
#
#
#
#FailureMessage Object: 0x16d012088
----- Native stack trace -----

 1: 0x102f976b4 node::NodePlatform::GetStackTracePrinter()::$_0::__invoke() [/Users/yagiz/coding/node/out/Release/node]
 2: 0x1045f5f9c V8_Fatal(char const*, ...) [/Users/yagiz/coding/node/out/Release/node]
 3: 0x1037742e8 v8::internal::Runtime_OptimizeOsr(int, unsigned long*, v8::internal::Isolate*) [/Users/yagiz/coding/node/out/Release/node]
 4: 0x103de3848 Builtins_CEntry_Return1_ArgvInRegister_NoBuiltinExit [/Users/yagiz/coding/node/out/Release/node]
 5: 0x103ec6114 Builtins_CallRuntimeHandler [/Users/yagiz/coding/node/out/Release/node]
 6: 0x103d4c838 Builtins_InterpreterEntryTrampoline [/Users/yagiz/coding/node/out/Release/node]
 7: 0x103d4c838 Builtins_InterpreterEntryTrampoline [/Users/yagiz/coding/node/out/Release/node]
 8: 0x103d4c838 Builtins_InterpreterEntryTrampoline [/Users/yagiz/coding/node/out/Release/node]
 9: 0x103d4c838 Builtins_InterpreterEntryTrampoline [/Users/yagiz/coding/node/out/Release/node]
10: 0x103d4c838 Builtins_InterpreterEntryTrampoline [/Users/yagiz/coding/node/out/Release/node]
11: 0x103d4c838 Builtins_InterpreterEntryTrampoline [/Users/yagiz/coding/node/out/Release/node]
12: 0x103d4c838 Builtins_InterpreterEntryTrampoline [/Users/yagiz/coding/node/out/Release/node]
13: 0x103d4c838 Builtins_InterpreterEntryTrampoline [/Users/yagiz/coding/node/out/Release/node]
14: 0x103d4c838 Builtins_InterpreterEntryTrampoline [/Users/yagiz/coding/node/out/Release/node]
15: 0x103d4c838 Builtins_InterpreterEntryTrampoline [/Users/yagiz/coding/node/out/Release/node]
16: 0x103d4a50c Builtins_JSEntryTrampoline [/Users/yagiz/coding/node/out/Release/node]
17: 0x103d4a1b0 Builtins_JSEntry [/Users/yagiz/coding/node/out/Release/node]
18: 0x1032a6980 v8::internal::(anonymous namespace)::Invoke(v8::internal::Isolate*, v8::internal::(anonymous namespace)::InvokeParams const&) [/Users/yagiz/coding/node/out/Release/node]
19: 0x1032a62e0 v8::internal::Execution::Call(v8::internal::Isolate*, v8::internal::Handle<v8::internal::Object>, v8::internal::Handle<v8::internal::Object>, int, v8::internal::Handle<v8::internal::Object>*) [/Users/yagiz/coding/node/out/Release/node]
20: 0x103142758 v8::Function::Call(v8::Isolate*, v8::Local<v8::Context>, v8::Local<v8::Value>, int, v8::Local<v8::Value>*) [/Users/yagiz/coding/node/out/Release/node]
21: 0x102ef65ac node::builtins::BuiltinLoader::CompileAndCall(v8::Local<v8::Context>, char const*, node::Realm*) [/Users/yagiz/coding/node/out/Release/node]
22: 0x102fa805c node::Realm::ExecuteBootstrapper(char const*) [/Users/yagiz/coding/node/out/Release/node]
23: 0x102ed513c node::StartExecution(node::Environment*, char const*) [/Users/yagiz/coding/node/out/Release/node]
24: 0x102ed5090 node::StartExecution(node::Environment*, std::__1::function<v8::MaybeLocal<v8::Value> (node::StartExecutionCallbackInfo const&)>) [/Users/yagiz/coding/node/out/Release/node]
25: 0x102e2ac7c node::LoadEnvironment(node::Environment*, std::__1::function<v8::MaybeLocal<v8::Value> (node::StartExecutionCallbackInfo const&)>, std::__1::function<void (node::Environment*, v8::Local<v8::Value>, v8::Local<v8::Value>)>) [/Users/yagiz/coding/node/out/Release/node]
26: 0x102f63840 node::NodeMainInstance::Run() [/Users/yagiz/coding/node/out/Release/node]
27: 0x102ed81b4 node::Start(int, char**) [/Users/yagiz/coding/node/out/Release/node]
28: 0x1886c8274 start [/usr/lib/dyld]
[1]    23707 trace trap  out/Release/node test/parallel/test-timers-now.js

anonrig avatar Nov 18 '24 15:11 anonrig

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 87.96%. Comparing base (a2edde4) to head (2081338). Report is 831 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #55905      +/-   ##
==========================================
- Coverage   88.49%   87.96%   -0.54%     
==========================================
  Files         653      656       +3     
  Lines      187735   188391     +656     
  Branches    36181    35976     -205     
==========================================
- Hits       166141   165710     -431     
- Misses      14819    15846    +1027     
- Partials     6775     6835      +60     
Files with missing lines Coverage Ξ”
src/timers.cc 86.72% <ΓΈ> (ΓΈ)

... and 116 files with indirect coverage changes

πŸš€ New features to boost your workflow:
  • ❄ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • πŸ“¦ JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

codecov[bot] avatar Nov 18 '24 16:11 codecov[bot]

I'm getting a runtime error with this. Am I missing something?

I think it's because you can't directly optimize a native function. You need to wrap it in a JS function and optimize that.

targos avatar Nov 19 '24 10:11 targos

CI: https://ci.nodejs.org/job/node-test-pull-request/63732/

nodejs-github-bot avatar Nov 27 '24 23:11 nodejs-github-bot

I'm getting a runtime error with this. Am I missing something?

I think it's because you can't directly optimize a native function. You need to wrap it in a JS function and optimize that.

Thanks. I updated the pull-request and you're indeed correct. It fixed the crash.

anonrig avatar Nov 27 '24 23:11 anonrig

CI: https://ci.nodejs.org/job/node-test-pull-request/63750/

nodejs-github-bot avatar Nov 28 '24 17:11 nodejs-github-bot

CI: https://ci.nodejs.org/job/node-test-pull-request/63789/

nodejs-github-bot avatar Nov 29 '24 20:11 nodejs-github-bot

CI: https://ci.nodejs.org/job/node-test-pull-request/63805/

nodejs-github-bot avatar Nov 30 '24 03:11 nodejs-github-bot

CI: https://ci.nodejs.org/job/node-test-pull-request/63888/

nodejs-github-bot avatar Dec 05 '24 02:12 nodejs-github-bot

CI: https://ci.nodejs.org/job/node-test-pull-request/63894/

nodejs-github-bot avatar Dec 05 '24 12:12 nodejs-github-bot

@targos any idea why this test is failing on arm-debug?

anonrig avatar Dec 06 '24 00:12 anonrig

It means that the fast API is not called during the test. Have you not tried it locally with debug mode ?

targos avatar Dec 06 '24 06:12 targos