fix test error

Signed-off-by: cherry530 <xuping33@huawei.com>
This commit is contained in:
cherry530 2023-02-10 17:11:21 +08:00
parent c7d7076692
commit 23f9e1fb63
2 changed files with 40 additions and 2 deletions

View File

@ -0,0 +1,35 @@
From e6699d13cdcd6abe543b250f4297808912a4a188 Mon Sep 17 00:00:00 2001
From: Richard Lau <riclau@uk.ibm.com>
Date: Tue, 2 Apr 2019 19:42:13 +0100
Subject: [PATCH] test: fix addon test for Node.js 12 and V8 7.4
V8 7.4 removes some API functions. Replace those with their NAN
counterparts.
PR-URL: https://github.com/nodejs/node-gyp/pull/1705
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
---
test/node_modules/hello_world/hello.cc | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/test/node_modules/hello_world/hello.cc b/test/node_modules/hello_world/hello.cc
index 89bfd7ac04..ea724e896c 100644
--- a/test/node_modules/hello_world/hello.cc
+++ b/test/node_modules/hello_world/hello.cc
@@ -1,12 +1,11 @@
#include <nan.h>
-void Method(const Nan::FunctionCallbackInfo<v8::Value>& info) {
+NAN_METHOD(Method) {
info.GetReturnValue().Set(Nan::New("world").ToLocalChecked());
}
-void Init(v8::Local<v8::Object> exports) {
- exports->Set(Nan::New("hello").ToLocalChecked(),
- Nan::New<v8::FunctionTemplate>(Method)->GetFunction());
+NAN_MODULE_INIT(Init) {
+ Nan::SetMethod(target, "hello", Method);
}
NODE_MODULE(hello, Init)

View File

@ -1,7 +1,7 @@
%{?nodejs_find_provides_and_requires}
Name: node-gyp
Version: 3.6.0
Release: 5
Release: 6
Summary: Node.js native addon build tool
License: MIT
URL: https://github.com/nodejs/node-gyp
@ -11,7 +11,7 @@ Patch1: node-gyp-addon-gypi.patch
Patch2: node-gyp-system-gyp.patch
Patch3: node-gyp-python.patch
Patch4: node-gyp-python3.patch
Patch5: node-gyp-node12.patch
Patch5: fix-addon-test-for-Node.js-12-and-v8.patch
BuildArch: noarch
ExclusiveArch: %{nodejs_arches} noarch
Requires: gyp nodejs-devel libuv-devel http-parser-devel gcc-c++
@ -53,6 +53,9 @@ rm -f test/test-download.js
%{_bindir}/node-gyp
%changelog
* Fri Feb 10 2023 xu_ping <xuping33@h-partners.com> - 3.6.0-6
- fix test error
* Tue Jul 05 2022 wangkai <wangkai385@h-partners.com> - 3.6.0-5
- Remove test-download