Modify use cases to run on WGR development board

description:Modify use cases to run on WGR development board
issue:https://gitee.com/openharmony/arkcompiler_ets_runtime/issues/I5QD96
Signed-off-by: jing_han <hanjing35@huawei.com>
This commit is contained in:
jing_han 2022-09-08 16:27:41 +08:00
parent bc5f967b66
commit 1fccbb976f
46 changed files with 141 additions and 16 deletions

View File

@ -28,6 +28,9 @@ namespace OHOS {
RuntimeOption option;
option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR);
EcmaVM *vm = JSNApi::CreateJSVM(option);
if (size <= 0) {
return;
}
Deleter deleter = nullptr;
ArrayBufferRef::New(vm, (void*)data, (int32_t)size, deleter, (void*)data);
JSNApi::DestroyJSVM(vm);

View File

@ -31,7 +31,9 @@ namespace OHOS {
option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR);
EcmaVM *vm = JSNApi::CreateJSVM(option);
int32_t input;
if (size <= 0) {
return;
}
if (size > MAXBYTELEN) {
size = MAXBYTELEN;
}

View File

@ -31,7 +31,9 @@ namespace OHOS {
option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR);
EcmaVM *vm = JSNApi::CreateJSVM(option);
int32_t input;
if (size <= 0) {
return;
}
if (size > MAXBYTELEN) {
size = MAXBYTELEN;
}

View File

@ -29,6 +29,9 @@ namespace OHOS {
EcmaVM *vm = JSNApi::CreateJSVM(option);
int64_t input = 0;
size_t maxByteLen = 8;
if (size <= 0) {
return;
}
if (size > maxByteLen) {
size = maxByteLen;
}

View File

@ -27,6 +27,9 @@ namespace OHOS {
RuntimeOption option;
option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR);
EcmaVM *vm = JSNApi::CreateJSVM(option);
if (size <= 0) {
return;
}
uint64_t input = 0;
size_t maxByteLen = 8;
if (size > maxByteLen) {

View File

@ -30,7 +30,9 @@ namespace OHOS {
option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR);
EcmaVM *vm = JSNApi::CreateJSVM(option);
int32_t input;
if (size <= 0) {
return;
}
if (size > MAXBYTELEN) {
size = MAXBYTELEN;
}

View File

@ -27,6 +27,9 @@ namespace OHOS {
RuntimeOption option;
option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR);
auto vm = JSNApi::CreateJSVM(option);
if (size <= 0) {
return;
}
bool input = true;
if (size == 0 || data == nullptr) {
input = false;

View File

@ -31,7 +31,9 @@ namespace OHOS {
option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR);
EcmaVM *vm = JSNApi::CreateJSVM(option);
int32_t input;
if (size <= 0) {
return;
}
if (size > MAXBYTELEN) {
size = MAXBYTELEN;
}

View File

@ -29,6 +29,9 @@ namespace OHOS {
RuntimeOption option;
option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR);
auto vm = JSNApi::CreateJSVM(option);
if (size <= 0) {
return;
}
double input = 0;
if (size > MAXBYTELEN) {
size = MAXBYTELEN;

View File

@ -27,6 +27,9 @@ namespace OHOS {
RuntimeOption option;
option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR);
auto vm = JSNApi::CreateJSVM(option);
if (size <= 0) {
return;
}
std::string message(data, data+size);
OnMessage(vm, std::move(message));
JSNApi::DestroyJSVM(vm);

View File

@ -31,6 +31,9 @@ namespace OHOS {
RuntimeOption option;
option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR);
EcmaVM *vm = JSNApi::CreateJSVM(option);
if (size <= 0) {
return;
}
int input = 0;
if (size > MAXBYTELEN) {
size = MAXBYTELEN;

View File

@ -32,6 +32,9 @@ namespace OHOS {
option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR);
EcmaVM *vm = JSNApi::CreateJSVM(option);
int input = 0;
if (size <= 0) {
return;
}
if (size > MAXBYTELEN) {
size = MAXBYTELEN;
}

View File

@ -28,6 +28,9 @@ namespace OHOS {
option.SetGcType(RuntimeOption::GC_TYPE::GEN_GC);
option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR);
auto vm = JSNApi::CreateJSVM(option);
if (size <= 0) {
return;
}
Local<StringRef> entry = StringRef::NewFromUtf8(vm, PANDA_MAIN_FUNCTION);
std::string a = entry->StringRef::ToString();
JSNApi::Execute(vm, data, size, a);

View File

@ -32,7 +32,9 @@ namespace OHOS {
option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR);
EcmaVM *vm = JSNApi::CreateJSVM(option);
int32_t input;
if (size <= 0) {
return;
}
if (size > MAXBYTELEN) {
size = MAXBYTELEN;
}

View File

@ -31,7 +31,9 @@ namespace OHOS {
option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR);
EcmaVM *vm = JSNApi::CreateJSVM(option);
int32_t input;
if (size <= 0) {
return;
}
if (size > MAXBYTELEN) {
size = MAXBYTELEN;
}

View File

@ -32,6 +32,9 @@ namespace OHOS {
RuntimeOption option;
option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR);
EcmaVM *vm = JSNApi::CreateJSVM(option);
if (size <= 0) {
return;
}
FunctionCallback nativeFunc = FuncRefCallCallbackForTest;
Deleter deleter = nullptr;
Local<FunctionRef> func = FunctionRef::New(vm, nativeFunc, deleter, (void *)(data + size));

View File

@ -33,6 +33,9 @@ namespace OHOS {
RuntimeOption option;
option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR);
EcmaVM *vm = JSNApi::CreateJSVM(option);
if (size <= 0) {
return;
}
FunctionCallback nativeFunc = FuncRefConCallbackForTest;
Deleter deleter = nullptr;
Local<FunctionRef> func = FunctionRef::New(vm, nativeFunc, deleter, (void *)(data + size));

View File

@ -32,6 +32,9 @@ namespace OHOS {
RuntimeOption option;
option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR);
EcmaVM *vm = JSNApi::CreateJSVM(option);
if (size <= 0) {
return;
}
FunctionCallback nativeFunc = FuncRefNewCallbackForTest;
Deleter deleter = nullptr;
FunctionRef::New(vm, nativeFunc, deleter, (void *)(data + size));

View File

@ -32,6 +32,9 @@ namespace OHOS {
RuntimeOption option;
option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR);
EcmaVM *vm = JSNApi::CreateJSVM(option);
if (size <= 0) {
return;
}
FunctionCallback nativeFunc = FuncRefNewCFCallbackForTest;
Deleter deleter = nullptr;
FunctionRef::NewClassFunction(vm, nativeFunc, deleter, (void *)(data + size));

View File

@ -27,6 +27,9 @@ namespace OHOS {
RuntimeOption option;
option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR);
EcmaVM *vm = JSNApi::CreateJSVM(option);
if (size <= 0) {
return;
}
int32_t index = 0;
size_t maxByteLen = 4;
if (size > maxByteLen) {

View File

@ -22,11 +22,14 @@ using namespace panda;
using namespace panda::ecmascript;
namespace OHOS {
bool GetWordsArrayFuzzTest(const uint8_t* data, size_t size)
void GetWordsArrayFuzzTest(const uint8_t* data, size_t size)
{
RuntimeOption option;
option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR);
EcmaVM *vm = JSNApi::CreateJSVM(option);
if (size <= 0) {
return;
}
bool sign = true;
const size_t uint64BytesNum = 8;
if (size < uint64BytesNum) {
@ -40,7 +43,7 @@ namespace OHOS {
Local<BigIntRef> bigWords(bigWordsValue);
bigWords->GetWordsArray(&sign, 1U, wordsArray);
JSNApi::DestroyJSVM(vm);
return true;
return;
}
size_t wordsNum = size / uint64BytesNum;
@ -69,7 +72,7 @@ namespace OHOS {
Local<BigIntRef> bigWords(bigWordsValue);
bigWords->GetWordsArray(&sign, wordsNum, wordsArray);
JSNApi::DestroyJSVM(vm);
return true;
return;
}
}

View File

@ -31,7 +31,9 @@ namespace OHOS {
option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR);
EcmaVM *vm = JSNApi::CreateJSVM(option);
int32_t input;
if (size <= 0) {
return;
}
if (size > MAXBYTELEN) {
size = MAXBYTELEN;
}

View File

@ -31,7 +31,9 @@ namespace OHOS {
option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR);
EcmaVM *vm = JSNApi::CreateJSVM(option);
int32_t input;
if (size <= 0) {
return;
}
if (size > MAXBYTELEN) {
size = MAXBYTELEN;
}

View File

@ -31,7 +31,9 @@ namespace OHOS {
option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR);
EcmaVM *vm = JSNApi::CreateJSVM(option);
int32_t input;
if (size <= 0) {
return;
}
if (size > MAXBYTELEN) {
size = MAXBYTELEN;
}

View File

@ -26,6 +26,9 @@ namespace OHOS {
RuntimeOption option;
option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR);
EcmaVM *vm = JSNApi::CreateJSVM(option);
if (size <= 0) {
return;
}
JSNApi::SetHostPromiseRejectionTracker(vm, (void *)(data + size), (void *)data);
JSNApi::DestroyJSVM(vm);
}

View File

@ -26,6 +26,9 @@ namespace OHOS {
RuntimeOption option;
option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR);
EcmaVM *vm = JSNApi::CreateJSVM(option);
if (size <= 0) {
return;
}
std::string dirPath(data, data + size);
std::string requestPath(data, data + size);
using CallbackType = std::function<std::string(std::string, std::string)>;

View File

@ -27,6 +27,9 @@ namespace OHOS {
RuntimeOption option;
option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR);
EcmaVM *vm = JSNApi::CreateJSVM(option);
if (size <= 0) {
return;
}
int32_t instanceId = 0;
const int32_t int32ByteLen = 4;
if (size > int32ByteLen) {

View File

@ -26,6 +26,9 @@ namespace OHOS {
RuntimeOption option;
option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR);
EcmaVM *vm = JSNApi::CreateJSVM(option);
if (size <= 0) {
return;
}
NativePointerRef::New(vm, (void *)(data + size));
JSNApi::DestroyJSVM(vm);
}

View File

@ -26,6 +26,9 @@ namespace OHOS {
RuntimeOption option;
option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR);
EcmaVM *vm = JSNApi::CreateJSVM(option);
if (size <= 0) {
return;
}
NativePointerCallback callBack = nullptr;
NativePointerRef::New(vm, (void *)(data + size), callBack, (void*)data);
JSNApi::DestroyJSVM(vm);

View File

@ -27,6 +27,9 @@ namespace OHOS {
RuntimeOption option;
option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR);
EcmaVM *vm = JSNApi::CreateJSVM(option);
if (size <= 0) {
return;
}
int64_t input = 0;
size_t maxByteLen = 8;
if (size > maxByteLen) {

View File

@ -27,6 +27,9 @@ namespace OHOS {
RuntimeOption option;
option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR);
EcmaVM *vm = JSNApi::CreateJSVM(option);
if (size <= 0) {
return;
}
uint64_t input = 0;
size_t maxByteLen = 8;
if (size > maxByteLen) {

View File

@ -30,6 +30,9 @@ namespace OHOS {
RuntimeOption option;
option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR);
auto vm = JSNApi::CreateJSVM(option);
if (size <= 0) {
return;
}
double input = 0;
if (size > MAXBYTELEN) {
size = MAXBYTELEN;

View File

@ -29,6 +29,9 @@ namespace OHOS {
RuntimeOption option;
option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR);
auto vm = JSNApi::CreateJSVM(option);
if (size <= 0) {
return;
}
int32_t input = 0;
if (size > INT32_BETY_SIZE) {
size = INT32_BETY_SIZE;

View File

@ -29,6 +29,9 @@ namespace OHOS {
RuntimeOption option;
option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR);
auto vm = JSNApi::CreateJSVM(option);
if (size <= 0) {
return;
}
int64_t input = 0;
if (size > INT64_BETY_SIZE) {
size = INT64_BETY_SIZE;

View File

@ -30,6 +30,9 @@ namespace OHOS {
option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR);
auto vm = JSNApi::CreateJSVM(option);
uint32_t input = 0;
if (size <= 0) {
return;
}
if (size > UINT32_BETY_SIZE) {
size = UINT32_BETY_SIZE;
}

View File

@ -27,6 +27,9 @@ namespace OHOS {
RuntimeOption option;
option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR);
EcmaVM *vm = JSNApi::CreateJSVM(option);
if (size <= 0) {
return;
}
uint32_t key = 0;
size_t maxByteLen = 4;
if (size > maxByteLen) {

View File

@ -27,6 +27,9 @@ namespace OHOS {
RuntimeOption option;
option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR);
EcmaVM *vm = JSNApi::CreateJSVM(option);
if (size <= 0) {
return;
}
int32_t key = 0;
size_t maxByteLen = 4;
if (size > maxByteLen) {

View File

@ -27,6 +27,9 @@ namespace OHOS {
RuntimeOption option;
option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR);
EcmaVM *vm = JSNApi::CreateJSVM(option);
if (size <= 0) {
return;
}
uint32_t key = 0;
size_t maxByteLen = 4;
if (size > maxByteLen) {

View File

@ -27,6 +27,9 @@ namespace OHOS {
RuntimeOption option;
option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR);
EcmaVM *vm = JSNApi::CreateJSVM(option);
if (size <= 0) {
return;
}
uint32_t key = 0;
size_t maxByteLen = 4;
if (size > maxByteLen) {

View File

@ -27,6 +27,9 @@ namespace OHOS {
RuntimeOption option;
option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR);
EcmaVM *vm = JSNApi::CreateJSVM(option);
if (size <= 0) {
return;
}
int32_t index = 0;
size_t maxByteLen = 4;
if (size > maxByteLen) {

View File

@ -27,6 +27,9 @@ namespace OHOS {
RuntimeOption option;
option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR);
EcmaVM *vm = JSNApi::CreateJSVM(option);
if (size <= 0) {
return;
}
std::string fileName(data, data + size);
#ifndef ECMASCRIPT_SUPPORT_CPUPROFILER
#define ECMASCRIPT_SUPPORT_CPUPROFILER

View File

@ -29,6 +29,9 @@ namespace OHOS {
RuntimeOption option;
option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR);
EcmaVM *vm = JSNApi::CreateJSVM(option);
if (size <= 0) {
return;
}
std::string path(data, data + size);
DFXJSNApi::StopHeapTracking(vm, path);
JSNApi::DestroyJSVM(vm);

View File

@ -30,7 +30,9 @@ namespace OHOS {
option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR);
EcmaVM *vm = JSNApi::CreateJSVM(option);
int32_t input;
if (size <= 0) {
return;
}
if (size > MAXBYTELEN) {
size = MAXBYTELEN;
}

View File

@ -31,7 +31,9 @@ namespace OHOS {
option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR);
EcmaVM *vm = JSNApi::CreateJSVM(option);
int32_t input;
if (size <= 0) {
return;
}
if (size > MAXBYTELEN) {
size = MAXBYTELEN;
}

View File

@ -31,7 +31,9 @@ namespace OHOS {
option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR);
EcmaVM *vm = JSNApi::CreateJSVM(option);
int32_t input;
if (size <= 0) {
return;
}
if (size > MAXBYTELEN) {
size = MAXBYTELEN;
}

View File

@ -31,7 +31,9 @@ namespace OHOS {
option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR);
EcmaVM *vm = JSNApi::CreateJSVM(option);
int32_t input;
if (size <= 0) {
return;
}
if (size > MAXBYTELEN) {
size = MAXBYTELEN;
}