mirror of
https://gitee.com/openharmony/arkcompiler_ets_runtime
synced 2024-10-06 23:54:03 +00:00
Descriptor: Add quickfix testcases
Details: 1. Add quickfix testcases 2. delete isPatch flag 3. use the same recore name of base and patch Issue: https://gitee.com/openharmony/arkcompiler_ets_runtime/issues/I5UPMC Signed-off-by: wengchangcheng <wengchangcheng@huawei.com> Change-Id: I1e03addb8f37240557df899fbee8bc99beb97e92
This commit is contained in:
parent
dedc3bf323
commit
aaf47ba3d0
3
BUILD.gn
3
BUILD.gn
@ -129,6 +129,9 @@ if (defined(ark_standalone_build)) {
|
||||
# js bytecode test
|
||||
deps += [ "//arkcompiler/ets_runtime/test/moduletest:ark_js_moduletest" ]
|
||||
|
||||
# quickfix test
|
||||
deps += [ "//arkcompiler/ets_runtime/test/quickfix:ark_quickfix_test" ]
|
||||
|
||||
# ts aot test and asm test
|
||||
if (is_standard_system && !run_with_asan) {
|
||||
deps += [
|
||||
|
@ -90,6 +90,8 @@ int Main(const int argc, const char **argv)
|
||||
return -1;
|
||||
}
|
||||
|
||||
bool isMergeAbc = runtimeOptions.GetMergeAbc();
|
||||
JSNApi::SetBundle(vm, !isMergeAbc);
|
||||
{
|
||||
LocalScope scope(vm);
|
||||
std::string entry = runtimeOptions.GetEntryPoint();
|
||||
|
@ -23,8 +23,8 @@
|
||||
#include "libpandafile/class_data_accessor-inl.h"
|
||||
|
||||
namespace panda::ecmascript {
|
||||
JSPandaFile::JSPandaFile(const panda_file::File *pf, const CString &descriptor, bool isPatch)
|
||||
: pf_(pf), desc_(descriptor), isPatch_(isPatch)
|
||||
JSPandaFile::JSPandaFile(const panda_file::File *pf, const CString &descriptor)
|
||||
: pf_(pf), desc_(descriptor)
|
||||
{
|
||||
ASSERT(pf_ != nullptr);
|
||||
#if ECMASCRIPT_ENABLE_MERGE_ABC
|
||||
@ -257,20 +257,20 @@ CString JSPandaFile::FindrecordName(const CString &recordName) const
|
||||
return name;
|
||||
}
|
||||
|
||||
std::string JSPandaFile::ParseOhmUrl(std::string fileName)
|
||||
CString JSPandaFile::ParseOhmUrl(const CString &fileName)
|
||||
{
|
||||
std::string bundleInstallName(BUNDLE_INSTALL_PATH);
|
||||
CString bundleInstallName(BUNDLE_INSTALL_PATH);
|
||||
size_t startStrLen = bundleInstallName.length();
|
||||
size_t pos = std::string::npos;
|
||||
size_t pos = CString::npos;
|
||||
|
||||
if (fileName.length() > startStrLen && fileName.compare(0, startStrLen, bundleInstallName) == 0) {
|
||||
pos = startStrLen;
|
||||
}
|
||||
std::string result = fileName;
|
||||
if (pos != std::string::npos) {
|
||||
CString result = fileName;
|
||||
if (pos != CString::npos) {
|
||||
result = fileName.substr(pos);
|
||||
pos = result.find('/');
|
||||
if (pos != std::string::npos) {
|
||||
if (pos != CString::npos) {
|
||||
result = result.substr(pos + 1);
|
||||
}
|
||||
} else {
|
||||
@ -278,14 +278,14 @@ std::string JSPandaFile::ParseOhmUrl(std::string fileName)
|
||||
result = MODULE_DEFAULE_ETS + result;
|
||||
}
|
||||
pos = result.find_last_of(".");
|
||||
if (pos != std::string::npos) {
|
||||
if (pos != CString::npos) {
|
||||
result = result.substr(0, pos);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
std::string JSPandaFile::ParseRecordName(const std::string &fileName)
|
||||
CString JSPandaFile::ParseRecordName(const CString &fileName)
|
||||
{
|
||||
size_t begin = fileName.find_last_of("/");
|
||||
ASSERT(begin != std::string::npos);
|
||||
|
@ -39,7 +39,6 @@ public:
|
||||
static constexpr char PATCH_ENTRY_FUNCTION[] = "_GLOBAL::patch_main_0";
|
||||
static constexpr char PATCH_FUNCTION_NAME_0[] = "patch_main_0";
|
||||
static constexpr char PATCH_FUNCTION_NAME_1[] = "patch_main_1";
|
||||
static constexpr char PATCH_RECORD_PREFIX[] = "Patch.";
|
||||
|
||||
static constexpr char MODULE_CLASS[] = "L_ESModuleRecord;";
|
||||
static constexpr char TS_TYPES_CLASS[] = "L_ESTypeInfoRecord;";
|
||||
@ -56,7 +55,7 @@ public:
|
||||
static constexpr char NODE_MODULES_ZERO[] = "node_modules/0/";
|
||||
static constexpr char NODE_MODULES_ONE[] = "node_modules/1/";
|
||||
|
||||
JSPandaFile(const panda_file::File *pf, const CString &descriptor, bool isPatch);
|
||||
JSPandaFile(const panda_file::File *pf, const CString &descriptor);
|
||||
~JSPandaFile();
|
||||
|
||||
const CString &GetJSPandaFileDesc() const
|
||||
@ -240,9 +239,6 @@ public:
|
||||
CString ParseEntryPoint(const CString &recordName) const
|
||||
{
|
||||
CString record = recordName.substr(1, recordName.size() - 2); // 2 : skip symbol "L" and ";"
|
||||
if (isPatch_) {
|
||||
record = PATCH_RECORD_PREFIX + record;
|
||||
}
|
||||
return record;
|
||||
}
|
||||
|
||||
@ -250,9 +246,9 @@ public:
|
||||
|
||||
CString FindrecordName(const CString &record) const;
|
||||
|
||||
static std::string ParseOhmUrl(std::string fileName);
|
||||
static CString ParseOhmUrl(const CString &fileName);
|
||||
// For local merge abc, get record name from file name.
|
||||
static std::string PUBLIC_API ParseRecordName(const std::string &fileName);
|
||||
static CString PUBLIC_API ParseRecordName(const CString &fileName);
|
||||
|
||||
private:
|
||||
void InitializeUnMergedPF();
|
||||
@ -272,7 +268,6 @@ private:
|
||||
bool isLoadedAOT_ {false};
|
||||
uint32_t typeSummaryOffset_ {0};
|
||||
bool isNewVersion_ {false};
|
||||
bool isPatch_ {false};
|
||||
|
||||
// marge abc
|
||||
bool isBundlePack_ {true}; // isBundlePack means app compile mode is JSBundle
|
||||
|
@ -31,9 +31,9 @@ Expected<JSTaggedValue, bool> JSPandaFileExecutor::ExecuteFromFile(JSThread *thr
|
||||
#if ECMASCRIPT_ENABLE_MERGE_ABC
|
||||
if (!thread->GetEcmaVM()->IsBundlePack()) {
|
||||
#if defined(PANDA_TARGET_LINUX)
|
||||
entry = JSPandaFile::ParseRecordName(filename.c_str());
|
||||
entry = JSPandaFile::ParseRecordName(filename);
|
||||
#else
|
||||
entry = JSPandaFile::ParseOhmUrl(filename.c_str());
|
||||
entry = JSPandaFile::ParseOhmUrl(filename);
|
||||
#if !WIN_OR_MAC_PLATFORM
|
||||
name = JSPandaFile::MERGE_ABC_PATH;
|
||||
#elif defined(PANDA_TARGET_WINDOWS)
|
||||
@ -107,7 +107,7 @@ Expected<JSTaggedValue, bool> JSPandaFileExecutor::ExecuteModuleBuffer(
|
||||
CString assetPath = thread->GetEcmaVM()->GetAssetPath().c_str();
|
||||
name = assetPath + "/modules.abc";
|
||||
#endif
|
||||
CString entry = ConvertToString(JSPandaFile::ParseOhmUrl(filename.c_str()));
|
||||
CString entry = JSPandaFile::ParseOhmUrl(filename);
|
||||
const JSPandaFile *jsPandaFile =
|
||||
JSPandaFileManager::GetInstance()->LoadJSPandaFile(thread, name, entry.c_str(), buffer, size);
|
||||
if (jsPandaFile == nullptr) {
|
||||
|
@ -44,7 +44,7 @@ JSPandaFileManager::~JSPandaFileManager()
|
||||
}
|
||||
|
||||
const JSPandaFile *JSPandaFileManager::LoadJSPandaFile(JSThread *thread, const CString &filename,
|
||||
std::string_view entryPoint, bool isPatch)
|
||||
std::string_view entryPoint)
|
||||
{
|
||||
{
|
||||
os::memory::LockHolder lock(jsPandaFileLock_);
|
||||
@ -61,13 +61,12 @@ const JSPandaFile *JSPandaFileManager::LoadJSPandaFile(JSThread *thread, const C
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const JSPandaFile *jsPandaFile = GenerateJSPandaFile(thread, pf.release(), filename, entryPoint, isPatch);
|
||||
const JSPandaFile *jsPandaFile = GenerateJSPandaFile(thread, pf.release(), filename, entryPoint);
|
||||
return jsPandaFile;
|
||||
}
|
||||
|
||||
const JSPandaFile *JSPandaFileManager::LoadJSPandaFile(JSThread *thread, const CString &filename,
|
||||
std::string_view entryPoint, const void *buffer, size_t size,
|
||||
bool isPatch)
|
||||
std::string_view entryPoint, const void *buffer, size_t size)
|
||||
{
|
||||
if (buffer == nullptr || size == 0) {
|
||||
return nullptr;
|
||||
@ -86,7 +85,7 @@ const JSPandaFile *JSPandaFileManager::LoadJSPandaFile(JSThread *thread, const C
|
||||
LOG_ECMA(ERROR) << "open file " << filename << " error";
|
||||
return nullptr;
|
||||
}
|
||||
const JSPandaFile *jsPandaFile = GenerateJSPandaFile(thread, pf.release(), filename, entryPoint, isPatch);
|
||||
const JSPandaFile *jsPandaFile = GenerateJSPandaFile(thread, pf.release(), filename, entryPoint);
|
||||
return jsPandaFile;
|
||||
}
|
||||
|
||||
@ -175,9 +174,9 @@ JSPandaFile *JSPandaFileManager::OpenJSPandaFile(const CString &filename)
|
||||
return jsPandaFile;
|
||||
}
|
||||
|
||||
JSPandaFile *JSPandaFileManager::NewJSPandaFile(const panda_file::File *pf, const CString &desc, bool isPatch)
|
||||
JSPandaFile *JSPandaFileManager::NewJSPandaFile(const panda_file::File *pf, const CString &desc)
|
||||
{
|
||||
return new JSPandaFile(pf, desc, isPatch);
|
||||
return new JSPandaFile(pf, desc);
|
||||
}
|
||||
|
||||
void JSPandaFileManager::ReleaseJSPandaFile(const JSPandaFile *jsPandaFile)
|
||||
@ -209,11 +208,10 @@ DebugInfoExtractor *JSPandaFileManager::GetJSPtExtractor(const JSPandaFile *jsPa
|
||||
}
|
||||
|
||||
const JSPandaFile *JSPandaFileManager::GenerateJSPandaFile(JSThread *thread, const panda_file::File *pf,
|
||||
const CString &desc, std::string_view entryPoint,
|
||||
bool isPatch)
|
||||
const CString &desc, std::string_view entryPoint)
|
||||
{
|
||||
ASSERT(GetJSPandaFile(pf) == nullptr);
|
||||
JSPandaFile *newJsPandaFile = NewJSPandaFile(pf, desc, isPatch);
|
||||
JSPandaFile *newJsPandaFile = NewJSPandaFile(pf, desc);
|
||||
|
||||
auto loader = thread->GetEcmaVM()->GetFileLoader();
|
||||
if (loader->hasLoaded(newJsPandaFile)) {
|
||||
|
@ -35,15 +35,14 @@ public:
|
||||
|
||||
JSHandle<Program> GenerateProgram(EcmaVM *vm, const JSPandaFile *jsPandaFile, std::string_view entryPoint);
|
||||
|
||||
const JSPandaFile *LoadJSPandaFile(JSThread *thread, const CString &filename, std::string_view entryPoint,
|
||||
bool isPatch = false);
|
||||
const JSPandaFile *LoadJSPandaFile(JSThread *thread, const CString &filename, std::string_view entryPoint);
|
||||
|
||||
const JSPandaFile *LoadJSPandaFile(JSThread *thread, const CString &filename, std::string_view entryPoint,
|
||||
const void *buffer, size_t size, bool isPatch = false);
|
||||
const void *buffer, size_t size);
|
||||
|
||||
JSPandaFile *OpenJSPandaFile(const CString &filename);
|
||||
|
||||
JSPandaFile *NewJSPandaFile(const panda_file::File *pf, const CString &desc, bool isPatch = false);
|
||||
JSPandaFile *NewJSPandaFile(const panda_file::File *pf, const CString &desc);
|
||||
|
||||
DebugInfoExtractor *GetJSPtExtractor(const JSPandaFile *jsPandaFile);
|
||||
|
||||
@ -75,7 +74,7 @@ private:
|
||||
};
|
||||
|
||||
const JSPandaFile *GenerateJSPandaFile(JSThread *thread, const panda_file::File *pf, const CString &desc,
|
||||
std::string_view entryPoint, bool isPatch);
|
||||
std::string_view entryPoint);
|
||||
void ReleaseJSPandaFile(const JSPandaFile *jsPandaFile);
|
||||
const JSPandaFile *GetJSPandaFile(const panda_file::File *pf);
|
||||
const JSPandaFile *FindJSPandaFileUnlocked(const CString &filename);
|
||||
|
@ -252,6 +252,13 @@ JSHandle<JSFunction> LiteralDataExtractor::DefineMethodInLiteral(JSThread *threa
|
||||
if (!entryPoint.empty()) {
|
||||
moduleName = entryPoint;
|
||||
entry = entryPoint;
|
||||
} else {
|
||||
#if defined(PANDA_TARGET_LINUX)
|
||||
if (!jsPandaFile->IsBundlePack()) {
|
||||
entry = JSPandaFile::ParseRecordName(moduleName);
|
||||
moduleName = entry;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
if (jsPandaFile->IsModule(entry)) {
|
||||
EcmaVM *vm = thread->GetEcmaVM();
|
||||
|
@ -37,7 +37,7 @@ bool QuickFixLoader::LoadPatch(JSThread *thread, const CString &patchFileName, c
|
||||
|
||||
// The entry point is not work for merge abc.
|
||||
patchFile_ = JSPandaFileManager::GetInstance()->LoadJSPandaFile(thread, patchFileName,
|
||||
JSPandaFile::PATCH_ENTRY_FUNCTION, true);
|
||||
JSPandaFile::PATCH_ENTRY_FUNCTION);
|
||||
if (patchFile_ == nullptr) {
|
||||
LOG_FULL(ERROR) << "load patch jsPandafile failed";
|
||||
return false;
|
||||
@ -58,7 +58,7 @@ bool QuickFixLoader::LoadPatch(JSThread *thread, const CString &patchFileName, c
|
||||
|
||||
patchFile_ = JSPandaFileManager::GetInstance()->LoadJSPandaFile(thread, patchFileName,
|
||||
JSPandaFile::PATCH_ENTRY_FUNCTION,
|
||||
patchBuffer, patchSize, true);
|
||||
patchBuffer, patchSize);
|
||||
if (patchFile_ == nullptr) {
|
||||
LOG_FULL(ERROR) << "load patch jsPandafile failed";
|
||||
return false;
|
||||
@ -69,6 +69,7 @@ bool QuickFixLoader::LoadPatch(JSThread *thread, const CString &patchFileName, c
|
||||
|
||||
bool QuickFixLoader::LoadPatchInternal(JSThread *thread)
|
||||
{
|
||||
// support multi constpool: baseFile_->GetPandaFile()->GetHeader()->num_indexes
|
||||
EcmaVM *vm = thread->GetEcmaVM();
|
||||
if (baseFile_->IsBundlePack() != patchFile_->IsBundlePack()) {
|
||||
LOG_FULL(ERROR) << "base and patch is not the same type hap!";
|
||||
@ -144,16 +145,32 @@ CVector<JSHandle<Program>> QuickFixLoader::ParseAllConstpoolWithMerge(JSThread *
|
||||
ObjectFactory *factory = thread->GetEcmaVM()->GetFactory();
|
||||
JSHandle<JSHClass> hclass = JSHandle<JSHClass>::Cast(vm->GetGlobalEnv()->GetFunctionClassWithProto());
|
||||
|
||||
bool isNewVersion = jsPandaFile->IsNewVersion();
|
||||
JSHandle<ConstantPool> constpool;
|
||||
JSTaggedValue constpoolValue = vm->FindConstpool(jsPandaFile, 0);
|
||||
if (constpoolValue.IsHole()) {
|
||||
if (isNewVersion) {
|
||||
const CString &filename = jsPandaFile->GetJSPandaFileDesc();
|
||||
#if defined(PANDA_TARGET_LINUX)
|
||||
CString entry = JSPandaFile::ParseRecordName(filename);
|
||||
#else
|
||||
CString entry = JSPandaFile::ParseOhmUrl(filename);
|
||||
#endif
|
||||
uint32_t mainMethodIndex = jsPandaFile->GetMainMethodIndex(entry);
|
||||
ASSERT(mainMethodIndex != 0);
|
||||
constpool = ConstantPool::CreateConstPool(vm, jsPandaFile, mainMethodIndex);
|
||||
} else {
|
||||
constpool = PandaFileTranslator::ParseConstPool(vm, jsPandaFile);
|
||||
}
|
||||
int32_t index = 0;
|
||||
int32_t total = 1;
|
||||
vm->AddConstpool(jsPandaFile, constpool.GetTaggedValue(), index, total);
|
||||
} else {
|
||||
constpool = JSHandle<ConstantPool>(thread, constpoolValue);
|
||||
}
|
||||
if (isNewVersion) {
|
||||
GenerateConstpoolCache(vm, jsPandaFile, constpool);
|
||||
}
|
||||
|
||||
CVector<JSHandle<Program>> programs;
|
||||
auto recordInfos = jsPandaFile->GetJSRecordInfo();
|
||||
@ -162,11 +179,13 @@ CVector<JSHandle<Program>> QuickFixLoader::ParseAllConstpoolWithMerge(JSThread *
|
||||
const CString &recordName = item.first;
|
||||
LOG_FULL(DEBUG) << "Parse constpool: " << fileName << ":" << recordName;
|
||||
vm->GetModuleManager()->HostResolveImportedModuleWithMerge(fileName, recordName);
|
||||
if (!isNewVersion) {
|
||||
PandaFileTranslator::ParseFuncAndLiteralConstPool(vm, jsPandaFile, recordName, constpool);
|
||||
}
|
||||
|
||||
// Generate Program for every record.
|
||||
uint32_t mainMethodIndex = jsPandaFile->GetMainMethodIndex(recordName);
|
||||
auto methodLiteral = jsPandaFile->FindMethodLiteral(mainMethodIndex);
|
||||
uint32_t recordIndex = jsPandaFile->GetMainMethodIndex(recordName);
|
||||
auto methodLiteral = jsPandaFile->FindMethodLiteral(recordIndex);
|
||||
JSHandle<Program> program = factory->NewProgram();
|
||||
if (methodLiteral == nullptr) {
|
||||
program->SetMainFunction(thread, JSTaggedValue::Undefined());
|
||||
@ -182,6 +201,80 @@ CVector<JSHandle<Program>> QuickFixLoader::ParseAllConstpoolWithMerge(JSThread *
|
||||
return programs;
|
||||
}
|
||||
|
||||
void QuickFixLoader::GenerateConstpoolCache(EcmaVM *vm, const JSPandaFile *jsPandaFile,
|
||||
JSHandle<ConstantPool> constpool)
|
||||
{
|
||||
ASSERT(jsPandaFile->IsNewVersion());
|
||||
auto thread = vm->GetJSThread();
|
||||
const panda_file::File *pf = jsPandaFile->GetPandaFile();
|
||||
Span<const uint32_t> classIndexes = jsPandaFile->GetClasses();
|
||||
for (const uint32_t index : classIndexes) {
|
||||
panda_file::File::EntityId classId(index);
|
||||
if (pf->IsExternal(classId)) {
|
||||
continue;
|
||||
}
|
||||
panda_file::ClassDataAccessor cda(*pf, classId);
|
||||
cda.EnumerateMethods([pf, thread, constpool](panda_file::MethodDataAccessor &mda) {
|
||||
auto codeId = mda.GetCodeId();
|
||||
ASSERT(codeId.has_value());
|
||||
panda_file::CodeDataAccessor codeDataAccessor(*pf, codeId.value());
|
||||
uint32_t codeSize = codeDataAccessor.GetCodeSize();
|
||||
const uint8_t *insns = codeDataAccessor.GetInstructions();
|
||||
|
||||
auto bcIns = BytecodeInstruction(insns);
|
||||
auto bcInsLast = bcIns.JumpTo(codeSize);
|
||||
while (bcIns.GetAddress() != bcInsLast.GetAddress()) {
|
||||
if (!bcIns.HasFlag(BytecodeInstruction::Flags::STRING_ID) ||
|
||||
!BytecodeInstruction::HasId(BytecodeInstruction::GetFormat(bcIns.GetOpcode()), 0)) {
|
||||
BytecodeInstruction::Opcode opcode = bcIns.GetOpcode();
|
||||
switch (opcode) {
|
||||
// add opcode about method
|
||||
case EcmaOpcode::DEFINEMETHOD_IMM8_ID16_IMM8:
|
||||
U_FALLTHROUGH;
|
||||
case EcmaOpcode::DEFINEMETHOD_IMM16_ID16_IMM8:
|
||||
U_FALLTHROUGH;
|
||||
case EcmaOpcode::DEFINEFUNC_IMM8_ID16_IMM8:
|
||||
U_FALLTHROUGH;
|
||||
case EcmaOpcode::DEFINEFUNC_IMM16_ID16_IMM8: {
|
||||
uint32_t id = bcIns.GetId().AsRawValue();
|
||||
ConstantPool::GetMethodFromCache(thread, constpool.GetTaggedValue(), id);
|
||||
break;
|
||||
}
|
||||
case EcmaOpcode::CREATEOBJECTWITHBUFFER_IMM8_ID16:
|
||||
U_FALLTHROUGH;
|
||||
case EcmaOpcode::CREATEOBJECTWITHBUFFER_IMM16_ID16: {
|
||||
uint32_t id = bcIns.GetId().AsRawValue();
|
||||
ConstantPool::GetLiteralFromCache<ConstPoolType::OBJECT_LITERAL>(
|
||||
thread, constpool.GetTaggedValue(), id);
|
||||
break;
|
||||
}
|
||||
case EcmaOpcode::CREATEARRAYWITHBUFFER_IMM8_ID16:
|
||||
U_FALLTHROUGH;
|
||||
case EcmaOpcode::CREATEARRAYWITHBUFFER_IMM16_ID16: {
|
||||
uint32_t id = bcIns.GetId().AsRawValue();
|
||||
ConstantPool::GetLiteralFromCache<ConstPoolType::ARRAY_LITERAL>(
|
||||
thread, constpool.GetTaggedValue(), id);
|
||||
break;
|
||||
}
|
||||
case EcmaOpcode::DEFINECLASSWITHBUFFER_IMM8_ID16_ID16_IMM16_V8:
|
||||
U_FALLTHROUGH;
|
||||
case EcmaOpcode::DEFINECLASSWITHBUFFER_IMM16_ID16_ID16_IMM16_V8: {
|
||||
uint32_t methodId = bcIns.GetId(0).AsRawValue();
|
||||
uint32_t literalId = bcIns.GetId(1).AsRawValue();
|
||||
ConstantPool::GetClassMethodFromCache(thread, constpool, methodId);
|
||||
ConstantPool::GetClassLiteralFromCache(thread, constpool, literalId);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
bcIns = bcIns.GetNext();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
bool QuickFixLoader::ReplaceMethod(JSThread *thread,
|
||||
const JSHandle<ConstantPool> &baseConstpool,
|
||||
const JSHandle<ConstantPool> &patchConstpool)
|
||||
@ -223,7 +316,7 @@ bool QuickFixLoader::ReplaceMethod(JSThread *thread,
|
||||
}
|
||||
// For merge abc, method and record name must be same to base.
|
||||
CString baseRecordName = GetRecordName(baseFile_, baseMethod->GetMethodId());
|
||||
if (patchRecordName != JSPandaFile::PATCH_RECORD_PREFIX + baseRecordName) {
|
||||
if (patchRecordName != baseRecordName) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -249,7 +342,7 @@ bool QuickFixLoader::ReplaceMethod(JSThread *thread,
|
||||
}
|
||||
// For merge abc, method and record name must be same to base.
|
||||
CString baseRecordName = GetRecordName(baseFile_, baseMethod->GetMethodId());
|
||||
if (patchRecordName != JSPandaFile::PATCH_RECORD_PREFIX + baseRecordName) {
|
||||
if (patchRecordName != baseRecordName) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -418,22 +511,22 @@ void QuickFixLoader::InsertBaseClassMethodInfo(uint32_t constpoolIndex, uint32_t
|
||||
bool QuickFixLoader::CheckIsInvalidPatch(EcmaVM *vm) const
|
||||
{
|
||||
DISALLOW_GARBAGE_COLLECTION;
|
||||
static constexpr size_t prefixSize = sizeof(JSPandaFile::PATCH_RECORD_PREFIX) - 1;
|
||||
|
||||
auto thread = vm->GetJSThread();
|
||||
auto moduleManager = vm->GetModuleManager();
|
||||
auto patchRecordInfos = patchFile_->GetJSRecordInfo();
|
||||
[[maybe_unused]] auto baseRecordInfos = baseFile_->GetJSRecordInfo();
|
||||
|
||||
for (const auto &patchItem : patchRecordInfos) {
|
||||
const CString &patchRecordName = patchItem.first;
|
||||
ASSERT(patchRecordName.substr(0, prefixSize) == JSPandaFile::PATCH_RECORD_PREFIX);
|
||||
CString baseRecordName = patchRecordName.substr(prefixSize);
|
||||
CString baseRecordName = patchRecordName;
|
||||
ASSERT(baseRecordInfos.find(baseRecordName) != baseRecordInfos.end());
|
||||
|
||||
JSHandle<SourceTextModule> patchModule = moduleManager->HostGetImportedModule(patchRecordName);
|
||||
JSHandle<SourceTextModule> patchModule =
|
||||
moduleManager->ResolveModuleWithMerge(thread, patchFile_, patchRecordName);
|
||||
JSHandle<SourceTextModule> baseModule = moduleManager->HostGetImportedModule(baseRecordName);
|
||||
|
||||
if (CheckIsModuleMismatch(vm->GetJSThread(), patchModule, baseModule)) {
|
||||
if (CheckIsModuleMismatch(thread, patchModule, baseModule)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -49,6 +49,7 @@ private:
|
||||
|
||||
CString GetRecordName(const JSPandaFile *jsPandaFile, EntityId methodId);
|
||||
CVector<JSHandle<Program>> ParseAllConstpoolWithMerge(JSThread *thread, const JSPandaFile *jsPandaFile);
|
||||
void GenerateConstpoolCache(EcmaVM *vm, const JSPandaFile *jsPandaFile, JSHandle<ConstantPool> constpool);
|
||||
|
||||
bool ExecutePatchMain(JSThread *thread, const JSHandle<Program> &patchProgram);
|
||||
bool ExecutePatchMain(JSThread *thread, const CVector<JSHandle<Program>> &programs);
|
||||
|
@ -256,7 +256,13 @@ JSHandle<SourceTextModule> ModuleManager::HostResolveImportedModuleWithMerge(con
|
||||
UNREACHABLE();
|
||||
}
|
||||
|
||||
return ResolveModuleWithMerge(thread, jsPandaFile, recordName);
|
||||
JSHandle<SourceTextModule> moduleRecord = ResolveModuleWithMerge(thread, jsPandaFile, recordName);
|
||||
JSHandle<NameDictionary> handleDict(thread, resolvedModules_);
|
||||
resolvedModules_ = NameDictionary::Put(thread, handleDict, JSHandle<JSTaggedValue>(recordNameHandle),
|
||||
JSHandle<JSTaggedValue>(moduleRecord), PropertyAttributes::Default())
|
||||
.GetTaggedValue();
|
||||
|
||||
return moduleRecord;
|
||||
}
|
||||
|
||||
JSHandle<SourceTextModule> ModuleManager::HostResolveImportedModule(const CString &referencingModule)
|
||||
@ -354,10 +360,6 @@ JSHandle<SourceTextModule> ModuleManager::ResolveModuleWithMerge(
|
||||
|
||||
JSHandle<JSTaggedValue> recordNameHandle = JSHandle<JSTaggedValue>::Cast(factory->NewFromUtf8(recordName));
|
||||
JSHandle<SourceTextModule>::Cast(moduleRecord)->SetEcmaModuleRecordName(thread, recordNameHandle);
|
||||
JSHandle<NameDictionary> dict(thread, resolvedModules_);
|
||||
resolvedModules_ =
|
||||
NameDictionary::Put(thread, dict, recordNameHandle, moduleRecord, PropertyAttributes::Default())
|
||||
.GetTaggedValue();
|
||||
return JSHandle<SourceTextModule>::Cast(moduleRecord);
|
||||
}
|
||||
|
||||
|
@ -564,17 +564,17 @@ bool JSNApi::ExecuteModuleFromBuffer(EcmaVM *vm, const void *data, int32_t size,
|
||||
return true;
|
||||
}
|
||||
|
||||
Local<ObjectRef> JSNApi::GetExportObject(EcmaVM *vm, const std::string &file, [[maybe_unused]] const std::string &key)
|
||||
Local<ObjectRef> JSNApi::GetExportObject(EcmaVM *vm, const std::string &file, const std::string &key)
|
||||
{
|
||||
std::string entry = file;
|
||||
ecmascript::CString entry = file.c_str();
|
||||
#if ECMASCRIPT_ENABLE_MERGE_ABC
|
||||
if (!vm->IsBundlePack()) {
|
||||
entry = ecmascript::JSPandaFile::ParseOhmUrl(file.c_str());
|
||||
entry = ecmascript::JSPandaFile::ParseOhmUrl(entry);
|
||||
}
|
||||
#endif
|
||||
ecmascript::ModuleManager *moduleManager = vm->GetModuleManager();
|
||||
JSThread *thread = vm->GetJSThread();
|
||||
JSHandle<ecmascript::SourceTextModule> ecmaModule = moduleManager->HostGetImportedModule(entry.c_str());
|
||||
JSHandle<ecmascript::SourceTextModule> ecmaModule = moduleManager->HostGetImportedModule(entry);
|
||||
if (ecmaModule->GetIsNewBcVersion()) {
|
||||
// 0: There's only one export value "default"
|
||||
JSHandle<JSTaggedValue> exportObj(thread, ecmaModule->GetModuleValue(thread, 0, false));
|
||||
@ -589,7 +589,7 @@ Local<ObjectRef> JSNApi::GetExportObject(EcmaVM *vm, const std::string &file, [[
|
||||
}
|
||||
|
||||
Local<ObjectRef> JSNApi::GetExportObjectFromBuffer(EcmaVM *vm, const std::string &file,
|
||||
[[maybe_unused]] const std::string &key)
|
||||
const std::string &key)
|
||||
{
|
||||
ecmascript::ModuleManager *moduleManager = vm->GetModuleManager();
|
||||
JSThread *thread = vm->GetJSThread();
|
||||
|
@ -60,15 +60,15 @@ int Main(const int argc, const char **argv)
|
||||
BlockSignals();
|
||||
|
||||
if (argc < 2) { // 2: at least have two arguments
|
||||
std::cerr << GetHelper();
|
||||
std::cout << GetHelper();
|
||||
return -1;
|
||||
}
|
||||
|
||||
int newArgc = argc;
|
||||
std::string files = argv[argc - 1];
|
||||
if (!base::StringHelper::EndsWith(files, ".abc")) {
|
||||
std::cerr << "The last argument must be abc file" << std::endl;
|
||||
std::cerr << GetHelper();
|
||||
std::cout << "The last argument must be abc file" << std::endl;
|
||||
std::cout << GetHelper();
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -76,7 +76,7 @@ int Main(const int argc, const char **argv)
|
||||
JSRuntimeOptions runtimeOptions;
|
||||
bool retOpt = runtimeOptions.ParseCommand(newArgc, argv);
|
||||
if (!retOpt) {
|
||||
std::cerr << GetHelper();
|
||||
std::cout << GetHelper();
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -86,12 +86,12 @@ int Main(const int argc, const char **argv)
|
||||
}
|
||||
EcmaVM *vm = JSNApi::CreateEcmaVM(runtimeOptions);
|
||||
if (vm == nullptr) {
|
||||
std::cerr << "Cannot Create vm" << std::endl;
|
||||
std::cout << "Cannot Create vm" << std::endl;
|
||||
return -1;
|
||||
}
|
||||
|
||||
{
|
||||
std::cout << "QuickFix Test start!" << std::endl;
|
||||
std::cout << "QuickFix Execute start" << std::endl;
|
||||
LocalScope scope(vm);
|
||||
std::string entry = runtimeOptions.GetEntryPoint();
|
||||
|
||||
@ -102,59 +102,63 @@ int Main(const int argc, const char **argv)
|
||||
#endif
|
||||
uint32_t len = fileNames.size();
|
||||
if (len < 4) { // 4: four abc file
|
||||
std::cerr << "Must include base.abc, patch.abc, test1.abc, test2.abc absolute path" << std::endl;
|
||||
std::cout << "Must include base.abc, patch.abc, test1.abc, test2.abc absolute path" << std::endl;
|
||||
return -1;
|
||||
}
|
||||
std::string baseFileName = fileNames[0];
|
||||
std::string patchFileName = fileNames[1]; // 1: second file, patch.abc
|
||||
std::string testLoadFileName = fileNames[2]; // 2: third file, test loadpatch abc file.
|
||||
std::string testUnloadFileName = fileNames[3]; // 3: fourth file, test unloadpatch abc file.
|
||||
|
||||
JSNApi::EnableUserUncaughtErrorHandler(vm);
|
||||
|
||||
bool isMergeAbc = runtimeOptions.GetMergeAbc();
|
||||
JSNApi::SetBundle(vm, !isMergeAbc);
|
||||
auto res = JSNApi::Execute(vm, baseFileName, entry);
|
||||
if (!res) {
|
||||
std::cerr << "Cannot execute panda file '" << baseFileName << "' with entry '" << entry << "'" << std::endl;
|
||||
std::cout << "Cannot execute panda file '" << baseFileName << "' with entry '" << entry << "'" << std::endl;
|
||||
return -1;
|
||||
}
|
||||
JSNApi::EnableUserUncaughtErrorHandler(vm);
|
||||
|
||||
std::string testLoadFileName = fileNames[1];
|
||||
std::string testUnloadFileName = fileNames[2]; // 2: third file, test unloadpatch abc file.
|
||||
for (uint32_t i = 3; i < len; i++) { // 3: patch file, test unloadpatch abc file.
|
||||
std::string patchFileName = fileNames[i];
|
||||
std::cout << "QuickFix start load patch" << std::endl;
|
||||
res = JSNApi::LoadPatch(vm, patchFileName, baseFileName);
|
||||
if (!res) {
|
||||
std::cerr << "LoadPatch failed!"<< std::endl;
|
||||
std::cout << "LoadPatch failed"<< std::endl;
|
||||
return -1;
|
||||
}
|
||||
std::cout << "QuickFix load patch success" << std::endl;
|
||||
|
||||
res = JSNApi::Execute(vm, testLoadFileName, entry);
|
||||
if (!res) {
|
||||
std::cerr << "Cannot execute panda file '" << testLoadFileName
|
||||
std::cout << "Cannot execute panda file '" << testLoadFileName
|
||||
<< "' with entry '" << entry << "'" << std::endl;
|
||||
return -1;
|
||||
}
|
||||
|
||||
Local<ObjectRef> exception = JSNApi::GetUncaughtException(vm);
|
||||
std::cout << "QuickFix start check exception" << std::endl;
|
||||
Local<ObjectRef> exception = JSNApi::GetAndClearUncaughtException(vm);
|
||||
res = JSNApi::IsQuickFixCausedException(vm, exception, patchFileName);
|
||||
if (res) {
|
||||
std::cout << "Patch have exception." << std::endl;
|
||||
std::cout << "QuickFix have exception." << std::endl;
|
||||
} else {
|
||||
std::cout << "-------------------------------------------" << std::endl;
|
||||
std::cout << "QuickFix have no exception" << std::endl;
|
||||
}
|
||||
|
||||
std::cout << "QuickFix start unload patch" << std::endl;
|
||||
res = JSNApi::UnloadPatch(vm, patchFileName);
|
||||
if (!res) {
|
||||
std::cerr << "UnloadPatch failed!" << std::endl;
|
||||
std::cout << "UnloadPatch failed!" << std::endl;
|
||||
return -1;
|
||||
}
|
||||
std::cout << "QuickFix unload patch success" << std::endl;
|
||||
|
||||
res = JSNApi::Execute(vm, testUnloadFileName, entry);
|
||||
if (!res) {
|
||||
std::cerr << "Cannot execute panda file '" << testUnloadFileName
|
||||
std::cout << "Cannot execute panda file '" << testUnloadFileName
|
||||
<< "' with entry '" << entry << "'" << std::endl;
|
||||
return -1;
|
||||
}
|
||||
|
||||
std::cout << "QuickFix Test end!" << std::endl;
|
||||
}
|
||||
std::cout << "QuickFix Execute end" << std::endl;
|
||||
}
|
||||
|
||||
JSNApi::DestroyJSVM(vm);
|
||||
|
@ -15,9 +15,8 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
Description: run script
|
||||
expect_output will get run result,
|
||||
expect_sub_output will catch pivotal sub output,
|
||||
expect_file will get print string
|
||||
input: resource file
|
||||
output: output file
|
||||
"""
|
||||
|
||||
import argparse
|
||||
|
51
test/quickfix/BUILD.gn
Normal file
51
test/quickfix/BUILD.gn
Normal file
@ -0,0 +1,51 @@
|
||||
# Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import("//arkcompiler/ets_runtime/test/test_helper.gni")
|
||||
|
||||
test_list = [
|
||||
"check_import",
|
||||
"class_inheritance",
|
||||
"class_mem_func",
|
||||
"class_mem_var",
|
||||
"class_name",
|
||||
"closure",
|
||||
"global_func",
|
||||
"global_var",
|
||||
"import_export",
|
||||
"print_string",
|
||||
]
|
||||
|
||||
host_quickfix_test_action("multi_patch") {
|
||||
extra_patches = [
|
||||
"patch1",
|
||||
"patch2",
|
||||
]
|
||||
}
|
||||
|
||||
foreach(testcase, test_list) {
|
||||
host_quickfix_test_action("${testcase}") {
|
||||
extra_patches = []
|
||||
}
|
||||
}
|
||||
|
||||
group("ark_quickfix_test") {
|
||||
testonly = true
|
||||
|
||||
deps = []
|
||||
foreach(testcase, test_list) {
|
||||
deps += [ ":${testcase}QuickfixAction" ]
|
||||
}
|
||||
|
||||
deps += [ ":multi_patchQuickfixAction" ]
|
||||
}
|
2
test/quickfix/base.txt
Normal file
2
test/quickfix/base.txt
Normal file
@ -0,0 +1,2 @@
|
||||
base.js;base;module;base.js
|
||||
module.js;module;module;module.js
|
20
test/quickfix/check_import/base.js
Normal file
20
test/quickfix/check_import/base.js
Normal file
@ -0,0 +1,20 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
function foo() {
|
||||
print("base foo")
|
||||
}
|
||||
|
||||
globalThis.foo = foo
|
16
test/quickfix/check_import/expect_output.txt
Normal file
16
test/quickfix/check_import/expect_output.txt
Normal file
@ -0,0 +1,16 @@
|
||||
# Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
QuickFix Execute start
|
||||
QuickFix start load patch
|
||||
LoadPatch failed
|
16
test/quickfix/check_import/module.js
Normal file
16
test/quickfix/check_import/module.js
Normal file
@ -0,0 +1,16 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export var nop = undefined
|
20
test/quickfix/check_import/patch/base.js
Normal file
20
test/quickfix/check_import/patch/base.js
Normal file
@ -0,0 +1,20 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { nop } from './module.js'
|
||||
|
||||
function foo() {
|
||||
print("patch foo")
|
||||
}
|
16
test/quickfix/check_import/patch/module.js
Normal file
16
test/quickfix/check_import/patch/module.js
Normal file
@ -0,0 +1,16 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export var nop = undefined
|
16
test/quickfix/check_import/test.js
Normal file
16
test/quickfix/check_import/test.js
Normal file
@ -0,0 +1,16 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
globalThis.foo()
|
29
test/quickfix/class_inheritance/base.js
Executable file
29
test/quickfix/class_inheritance/base.js
Executable file
@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
class BaseA {
|
||||
constructor() {
|
||||
}
|
||||
PrintStr() {
|
||||
print("print BaseA");
|
||||
}
|
||||
}
|
||||
|
||||
class A {
|
||||
constructor() {
|
||||
}
|
||||
}
|
||||
|
||||
globalThis.AA = new A();
|
23
test/quickfix/class_inheritance/expect_output.txt
Normal file
23
test/quickfix/class_inheritance/expect_output.txt
Normal file
@ -0,0 +1,23 @@
|
||||
# Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
QuickFix Execute start
|
||||
QuickFix start load patch
|
||||
QuickFix load patch success
|
||||
AA.PrintStr not function
|
||||
QuickFix start check exception
|
||||
QuickFix have no exception
|
||||
QuickFix start unload patch
|
||||
QuickFix unload patch success
|
||||
AA.PrintStr not function
|
||||
QuickFix Execute end
|
16
test/quickfix/class_inheritance/module.js
Normal file
16
test/quickfix/class_inheritance/module.js
Normal file
@ -0,0 +1,16 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export var nop = undefined
|
28
test/quickfix/class_inheritance/patch/base.js
Executable file
28
test/quickfix/class_inheritance/patch/base.js
Executable file
@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
class BaseA {
|
||||
constructor() {
|
||||
}
|
||||
PrintStr() {
|
||||
print("print BaseA");
|
||||
}
|
||||
}
|
||||
|
||||
class A extends BaseA {
|
||||
constructor() {
|
||||
super();
|
||||
}
|
||||
}
|
16
test/quickfix/class_inheritance/patch/module.js
Normal file
16
test/quickfix/class_inheritance/patch/module.js
Normal file
@ -0,0 +1,16 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export var nop = undefined
|
20
test/quickfix/class_inheritance/test.js
Executable file
20
test/quickfix/class_inheritance/test.js
Executable file
@ -0,0 +1,20 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
if (AA.PrintStr instanceof Function) {
|
||||
AA.PrintStr()
|
||||
} else {
|
||||
print("AA.PrintStr not function")
|
||||
}
|
30
test/quickfix/class_mem_func/base.js
Executable file
30
test/quickfix/class_mem_func/base.js
Executable file
@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
class C {
|
||||
constructor() {
|
||||
}
|
||||
PrintBase() {
|
||||
print("print base");
|
||||
}
|
||||
}
|
||||
|
||||
function A() {
|
||||
var c = new C()
|
||||
c.PrintBase()
|
||||
}
|
||||
|
||||
globalThis.A = A;
|
||||
globalThis.C = new C();
|
23
test/quickfix/class_mem_func/expect_output.txt
Normal file
23
test/quickfix/class_mem_func/expect_output.txt
Normal file
@ -0,0 +1,23 @@
|
||||
# Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
QuickFix Execute start
|
||||
QuickFix start load patch
|
||||
QuickFix load patch success
|
||||
print base patch
|
||||
QuickFix start check exception
|
||||
QuickFix have exception.
|
||||
QuickFix start unload patch
|
||||
QuickFix unload patch success
|
||||
print base
|
||||
QuickFix Execute end
|
16
test/quickfix/class_mem_func/module.js
Normal file
16
test/quickfix/class_mem_func/module.js
Normal file
@ -0,0 +1,16 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export var nop = undefined
|
31
test/quickfix/class_mem_func/patch/base.js
Executable file
31
test/quickfix/class_mem_func/patch/base.js
Executable file
@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
class C {
|
||||
constructor() {
|
||||
}
|
||||
PrintBase() {
|
||||
print("print base patch" );
|
||||
}
|
||||
PrintPatch() {
|
||||
print("print patch");
|
||||
}
|
||||
}
|
||||
|
||||
function A() {
|
||||
var c = new C()
|
||||
c.PrintBase()
|
||||
c.PrintPatch()
|
||||
}
|
16
test/quickfix/class_mem_func/patch/module.js
Normal file
16
test/quickfix/class_mem_func/patch/module.js
Normal file
@ -0,0 +1,16 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export var nop = undefined
|
16
test/quickfix/class_mem_func/test.js
Executable file
16
test/quickfix/class_mem_func/test.js
Executable file
@ -0,0 +1,16 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
A()
|
26
test/quickfix/class_mem_var/base.js
Executable file
26
test/quickfix/class_mem_var/base.js
Executable file
@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
class A {
|
||||
constructor() {
|
||||
this.str = "base"
|
||||
}
|
||||
PrintStr() {
|
||||
print("print base str :" + this.str);
|
||||
}
|
||||
}
|
||||
|
||||
globalThis.A = A;
|
||||
globalThis.AA = new A();
|
27
test/quickfix/class_mem_var/expect_output.txt
Normal file
27
test/quickfix/class_mem_var/expect_output.txt
Normal file
@ -0,0 +1,27 @@
|
||||
# Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
QuickFix Execute start
|
||||
QuickFix start load patch
|
||||
QuickFix load patch success
|
||||
print patch str :patch
|
||||
print patch new :a
|
||||
print patch str :base
|
||||
print patch new :undefined
|
||||
QuickFix start check exception
|
||||
QuickFix have no exception
|
||||
QuickFix start unload patch
|
||||
QuickFix unload patch success
|
||||
print base str :base
|
||||
print base str :base
|
||||
QuickFix Execute end
|
16
test/quickfix/class_mem_var/module.js
Normal file
16
test/quickfix/class_mem_var/module.js
Normal file
@ -0,0 +1,16 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export var nop = undefined
|
25
test/quickfix/class_mem_var/patch/base.js
Executable file
25
test/quickfix/class_mem_var/patch/base.js
Executable file
@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
class A {
|
||||
constructor() {
|
||||
this.str = "patch"
|
||||
this.a = "a"
|
||||
}
|
||||
PrintStr() {
|
||||
print("print patch str :" + this.str);
|
||||
print("print patch new :" + this.a);
|
||||
}
|
||||
}
|
16
test/quickfix/class_mem_var/patch/module.js
Normal file
16
test/quickfix/class_mem_var/patch/module.js
Normal file
@ -0,0 +1,16 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export var nop = undefined
|
18
test/quickfix/class_mem_var/test.js
Executable file
18
test/quickfix/class_mem_var/test.js
Executable file
@ -0,0 +1,18 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
const a = new A();
|
||||
a.PrintStr();
|
||||
AA.PrintStr()
|
29
test/quickfix/class_name/base.js
Executable file
29
test/quickfix/class_name/base.js
Executable file
@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
function foo() {
|
||||
class C1 {
|
||||
constructor() {
|
||||
}
|
||||
PrintStr() {
|
||||
print("print base str");
|
||||
}
|
||||
}
|
||||
|
||||
var c = new C1()
|
||||
c.PrintStr()
|
||||
}
|
||||
|
||||
globalThis.foo = foo;
|
23
test/quickfix/class_name/expect_output.txt
Normal file
23
test/quickfix/class_name/expect_output.txt
Normal file
@ -0,0 +1,23 @@
|
||||
# Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
QuickFix Execute start
|
||||
QuickFix start load patch
|
||||
QuickFix load patch success
|
||||
print patch str
|
||||
QuickFix start check exception
|
||||
QuickFix have no exception
|
||||
QuickFix start unload patch
|
||||
QuickFix unload patch success
|
||||
print base str
|
||||
QuickFix Execute end
|
16
test/quickfix/class_name/module.js
Normal file
16
test/quickfix/class_name/module.js
Normal file
@ -0,0 +1,16 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export var nop = undefined
|
27
test/quickfix/class_name/patch/base.js
Executable file
27
test/quickfix/class_name/patch/base.js
Executable file
@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
function foo() {
|
||||
class C2 {
|
||||
constructor() {
|
||||
}
|
||||
PrintStr() {
|
||||
print("print patch str");
|
||||
}
|
||||
}
|
||||
|
||||
var c = new C2()
|
||||
c.PrintStr()
|
||||
}
|
16
test/quickfix/class_name/patch/module.js
Normal file
16
test/quickfix/class_name/patch/module.js
Normal file
@ -0,0 +1,16 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export var nop = undefined
|
16
test/quickfix/class_name/test.js
Executable file
16
test/quickfix/class_name/test.js
Executable file
@ -0,0 +1,16 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
foo()
|
32
test/quickfix/closure/base.js
Executable file
32
test/quickfix/closure/base.js
Executable file
@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
var e1 = -1
|
||||
|
||||
function A() {
|
||||
var a1 = 1
|
||||
function B() {
|
||||
var b1 = 11
|
||||
function C() {
|
||||
print("base: " + e1)
|
||||
print("base: " + a1)
|
||||
print("base: " + b1)
|
||||
}
|
||||
C()
|
||||
}
|
||||
B()
|
||||
}
|
||||
|
||||
globalThis.A = A
|
31
test/quickfix/closure/expect_output.txt
Normal file
31
test/quickfix/closure/expect_output.txt
Normal file
@ -0,0 +1,31 @@
|
||||
# Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
QuickFix Execute start
|
||||
QuickFix start load patch
|
||||
QuickFix load patch success
|
||||
patch: -1
|
||||
patch: 2
|
||||
patch: 3
|
||||
patch: 4
|
||||
patch: 12
|
||||
patch: 13
|
||||
patch: 14
|
||||
QuickFix start check exception
|
||||
QuickFix have no exception
|
||||
QuickFix start unload patch
|
||||
QuickFix unload patch success
|
||||
base: -1
|
||||
base: 1
|
||||
base: 11
|
||||
QuickFix Execute end
|
16
test/quickfix/closure/module.js
Normal file
16
test/quickfix/closure/module.js
Normal file
@ -0,0 +1,16 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export var nop = undefined
|
38
test/quickfix/closure/patch/base.js
Executable file
38
test/quickfix/closure/patch/base.js
Executable file
@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
var e1 = -10
|
||||
|
||||
function A() {
|
||||
var a0 = 2
|
||||
var a1 = 3
|
||||
var a2 = 4
|
||||
function B() {
|
||||
var b0 = 12
|
||||
var b1 = 13
|
||||
var b2 = 14
|
||||
function C() {
|
||||
print("patch: " + e1)
|
||||
print("patch: " + a0)
|
||||
print("patch: " + a1)
|
||||
print("patch: " + a2)
|
||||
print("patch: " + b0)
|
||||
print("patch: " + b1)
|
||||
print("patch: " + b2)
|
||||
}
|
||||
C()
|
||||
}
|
||||
B()
|
||||
}
|
16
test/quickfix/closure/patch/module.js
Normal file
16
test/quickfix/closure/patch/module.js
Normal file
@ -0,0 +1,16 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export var nop = undefined
|
16
test/quickfix/closure/test.js
Executable file
16
test/quickfix/closure/test.js
Executable file
@ -0,0 +1,16 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
A();
|
47
test/quickfix/generate_merge_file.py
Executable file
47
test/quickfix/generate_merge_file.py
Executable file
@ -0,0 +1,47 @@
|
||||
#!/usr/bin/env python3
|
||||
#coding: utf-8
|
||||
"""
|
||||
Copyright (c) 2022-2023 Huawei Device Co., Ltd.
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
Description: run script
|
||||
input: input file
|
||||
output: output file
|
||||
prefix: prefix
|
||||
"""
|
||||
|
||||
import argparse
|
||||
import sys
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('--input', type=str, required=True)
|
||||
parser.add_argument('--output', type=str, required=True)
|
||||
parser.add_argument('--prefix', type=str, required=True)
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
input_file = open(args.input, 'r')
|
||||
output_file = open(args.output, 'w')
|
||||
|
||||
for line in input_file:
|
||||
output_line = args.prefix + line
|
||||
output_file.write(output_line)
|
||||
|
||||
input_file.close()
|
||||
output_file.close()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(main())
|
26
test/quickfix/global_func/base.js
Executable file
26
test/quickfix/global_func/base.js
Executable file
@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
function A() {
|
||||
print("base A()");
|
||||
globalThis.C()
|
||||
}
|
||||
|
||||
function C() {
|
||||
print("base C()");
|
||||
}
|
||||
|
||||
globalThis.A = A;
|
||||
globalThis.C = C;
|
24
test/quickfix/global_func/expect_output.txt
Normal file
24
test/quickfix/global_func/expect_output.txt
Normal file
@ -0,0 +1,24 @@
|
||||
# Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
QuickFix Execute start
|
||||
QuickFix start load patch
|
||||
QuickFix load patch success
|
||||
base A()
|
||||
QuickFix start check exception
|
||||
QuickFix have exception.
|
||||
QuickFix start unload patch
|
||||
QuickFix unload patch success
|
||||
base A()
|
||||
base C()
|
||||
QuickFix Execute end
|
16
test/quickfix/global_func/module.js
Normal file
16
test/quickfix/global_func/module.js
Normal file
@ -0,0 +1,16 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export var nop = undefined
|
25
test/quickfix/global_func/patch/base.js
Executable file
25
test/quickfix/global_func/patch/base.js
Executable file
@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
function A() {
|
||||
print("base A()");
|
||||
globalThis.B();
|
||||
}
|
||||
|
||||
function B() {
|
||||
print("patch B()");
|
||||
}
|
||||
|
||||
globalThis.B = B;
|
16
test/quickfix/global_func/patch/module.js
Normal file
16
test/quickfix/global_func/patch/module.js
Normal file
@ -0,0 +1,16 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export var nop = undefined
|
16
test/quickfix/global_func/test.js
Executable file
16
test/quickfix/global_func/test.js
Executable file
@ -0,0 +1,16 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
A();
|
22
test/quickfix/global_var/base.js
Executable file
22
test/quickfix/global_var/base.js
Executable file
@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
globalThis.a = 100
|
||||
|
||||
function A() {
|
||||
print("base global var :" + globalThis.a);
|
||||
}
|
||||
|
||||
globalThis.A = A;
|
24
test/quickfix/global_var/expect_output.txt
Normal file
24
test/quickfix/global_var/expect_output.txt
Normal file
@ -0,0 +1,24 @@
|
||||
# Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
QuickFix Execute start
|
||||
QuickFix start load patch
|
||||
QuickFix load patch success
|
||||
patch old global var :100
|
||||
patch new global var :undefined
|
||||
QuickFix start check exception
|
||||
QuickFix have no exception
|
||||
QuickFix start unload patch
|
||||
QuickFix unload patch success
|
||||
base global var :100
|
||||
QuickFix Execute end
|
16
test/quickfix/global_var/module.js
Normal file
16
test/quickfix/global_var/module.js
Normal file
@ -0,0 +1,16 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export var nop = undefined
|
24
test/quickfix/global_var/patch/base.js
Executable file
24
test/quickfix/global_var/patch/base.js
Executable file
@ -0,0 +1,24 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
globalThis.a = 200
|
||||
globalThis.b = 300
|
||||
|
||||
function A() {
|
||||
// old value will not update
|
||||
print("patch old global var :" + globalThis.a);
|
||||
// new value is undefined
|
||||
print("patch new global var :" + globalThis.b);
|
||||
}
|
16
test/quickfix/global_var/patch/module.js
Normal file
16
test/quickfix/global_var/patch/module.js
Normal file
@ -0,0 +1,16 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export var nop = undefined
|
16
test/quickfix/global_var/test.js
Executable file
16
test/quickfix/global_var/test.js
Executable file
@ -0,0 +1,16 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
A();
|
24
test/quickfix/import_export/base.js
Executable file
24
test/quickfix/import_export/base.js
Executable file
@ -0,0 +1,24 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { a } from './module.js'
|
||||
import { foo } from './module.js'
|
||||
|
||||
function A() {
|
||||
print("print base: " + a);
|
||||
foo()
|
||||
}
|
||||
|
||||
globalThis.A = A;
|
25
test/quickfix/import_export/expect_output.txt
Normal file
25
test/quickfix/import_export/expect_output.txt
Normal file
@ -0,0 +1,25 @@
|
||||
# Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
QuickFix Execute start
|
||||
QuickFix start load patch
|
||||
QuickFix load patch success
|
||||
print patch: 100
|
||||
patch foo
|
||||
QuickFix start check exception
|
||||
QuickFix have no exception
|
||||
QuickFix start unload patch
|
||||
QuickFix unload patch success
|
||||
print base: 100
|
||||
base foo
|
||||
QuickFix Execute end
|
19
test/quickfix/import_export/module.js
Normal file
19
test/quickfix/import_export/module.js
Normal file
@ -0,0 +1,19 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export var a = 100
|
||||
export function foo() {
|
||||
print("base foo")
|
||||
}
|
22
test/quickfix/import_export/patch/base.js
Executable file
22
test/quickfix/import_export/patch/base.js
Executable file
@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { a } from './module.js'
|
||||
import { foo } from './module.js'
|
||||
|
||||
function A() {
|
||||
print("print patch: " + a);
|
||||
foo()
|
||||
}
|
19
test/quickfix/import_export/patch/module.js
Normal file
19
test/quickfix/import_export/patch/module.js
Normal file
@ -0,0 +1,19 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export var a = 200
|
||||
export function foo() {
|
||||
print("patch foo")
|
||||
}
|
16
test/quickfix/import_export/test.js
Executable file
16
test/quickfix/import_export/test.js
Executable file
@ -0,0 +1,16 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
A();
|
28
test/quickfix/multi_patch/base.js
Executable file
28
test/quickfix/multi_patch/base.js
Executable file
@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { a } from './module.js'
|
||||
import { foo } from './module.js'
|
||||
|
||||
class Index {
|
||||
constructor() {
|
||||
}
|
||||
|
||||
render() {
|
||||
print("print base:" + a + " - " + foo());
|
||||
}
|
||||
}
|
||||
|
||||
globalThis.index = new Index();
|
39
test/quickfix/multi_patch/expect_output.txt
Normal file
39
test/quickfix/multi_patch/expect_output.txt
Normal file
@ -0,0 +1,39 @@
|
||||
# Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
QuickFix Execute start
|
||||
QuickFix start load patch
|
||||
QuickFix load patch success
|
||||
print patch:100 - 200
|
||||
QuickFix start check exception
|
||||
QuickFix have no exception
|
||||
QuickFix start unload patch
|
||||
QuickFix unload patch success
|
||||
print base:100 - 100
|
||||
QuickFix start load patch
|
||||
QuickFix load patch success
|
||||
print patch1:100 - 300
|
||||
QuickFix start check exception
|
||||
QuickFix have no exception
|
||||
QuickFix start unload patch
|
||||
QuickFix unload patch success
|
||||
print base:100 - 100
|
||||
QuickFix start load patch
|
||||
QuickFix load patch success
|
||||
print patch2: 100 - 400
|
||||
QuickFix start check exception
|
||||
QuickFix have no exception
|
||||
QuickFix start unload patch
|
||||
QuickFix unload patch success
|
||||
print base:100 - 100
|
||||
QuickFix Execute end
|
20
test/quickfix/multi_patch/module.js
Normal file
20
test/quickfix/multi_patch/module.js
Normal file
@ -0,0 +1,20 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export var a = 100
|
||||
export function foo() {
|
||||
var b = 100
|
||||
return b
|
||||
}
|
26
test/quickfix/multi_patch/patch/base.js
Executable file
26
test/quickfix/multi_patch/patch/base.js
Executable file
@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { a } from './module.js'
|
||||
import { foo } from './module.js'
|
||||
|
||||
class Index {
|
||||
constructor() {
|
||||
}
|
||||
|
||||
render() {
|
||||
print("print patch:" + a + " - " + foo());
|
||||
}
|
||||
}
|
20
test/quickfix/multi_patch/patch/module.js
Normal file
20
test/quickfix/multi_patch/patch/module.js
Normal file
@ -0,0 +1,20 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export var a = 200
|
||||
export function foo() {
|
||||
var b = 200
|
||||
return b
|
||||
}
|
26
test/quickfix/multi_patch/patch1/base.js
Executable file
26
test/quickfix/multi_patch/patch1/base.js
Executable file
@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { a } from './module.js'
|
||||
import { foo } from './module.js'
|
||||
|
||||
class Index {
|
||||
constructor() {
|
||||
}
|
||||
|
||||
render() {
|
||||
print("print patch1:" + a + " - " + foo());
|
||||
}
|
||||
}
|
20
test/quickfix/multi_patch/patch1/module.js
Normal file
20
test/quickfix/multi_patch/patch1/module.js
Normal file
@ -0,0 +1,20 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export var a = 300
|
||||
export function foo() {
|
||||
var b = 300
|
||||
return b
|
||||
}
|
26
test/quickfix/multi_patch/patch2/base.js
Executable file
26
test/quickfix/multi_patch/patch2/base.js
Executable file
@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { a } from './module.js'
|
||||
import { foo } from './module.js'
|
||||
|
||||
class Index {
|
||||
constructor() {
|
||||
}
|
||||
|
||||
render() {
|
||||
print("print patch2: " + a + " - " + foo());
|
||||
}
|
||||
}
|
20
test/quickfix/multi_patch/patch2/module.js
Normal file
20
test/quickfix/multi_patch/patch2/module.js
Normal file
@ -0,0 +1,20 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export var a = 400
|
||||
export function foo() {
|
||||
var b = 400
|
||||
return b
|
||||
}
|
16
test/quickfix/multi_patch/test.js
Executable file
16
test/quickfix/multi_patch/test.js
Executable file
@ -0,0 +1,16 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
globalThis.index.render()
|
20
test/quickfix/print_string/base.js
Normal file
20
test/quickfix/print_string/base.js
Normal file
@ -0,0 +1,20 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
function foo() {
|
||||
print("base foo")
|
||||
}
|
||||
|
||||
globalThis.foo = foo
|
23
test/quickfix/print_string/expect_output.txt
Normal file
23
test/quickfix/print_string/expect_output.txt
Normal file
@ -0,0 +1,23 @@
|
||||
# Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
QuickFix Execute start
|
||||
QuickFix start load patch
|
||||
QuickFix load patch success
|
||||
patch foo
|
||||
QuickFix start check exception
|
||||
QuickFix have no exception
|
||||
QuickFix start unload patch
|
||||
QuickFix unload patch success
|
||||
base foo
|
||||
QuickFix Execute end
|
16
test/quickfix/print_string/module.js
Normal file
16
test/quickfix/print_string/module.js
Normal file
@ -0,0 +1,16 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export var nop = undefined
|
18
test/quickfix/print_string/patch/base.js
Normal file
18
test/quickfix/print_string/patch/base.js
Normal file
@ -0,0 +1,18 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
function foo() {
|
||||
print("patch foo")
|
||||
}
|
16
test/quickfix/print_string/patch/module.js
Normal file
16
test/quickfix/print_string/patch/module.js
Normal file
@ -0,0 +1,16 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export var nop = undefined
|
16
test/quickfix/print_string/test.js
Normal file
16
test/quickfix/print_string/test.js
Normal file
@ -0,0 +1,16 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
globalThis.foo()
|
1
test/quickfix/retest.txt
Normal file
1
test/quickfix/retest.txt
Normal file
@ -0,0 +1 @@
|
||||
test.js;retest;module;test.js
|
1
test/quickfix/test.txt
Normal file
1
test/quickfix/test.txt
Normal file
@ -0,0 +1 @@
|
||||
test.js;test;module;test.js
|
@ -608,3 +608,245 @@ template("host_typeinfer_test_action") {
|
||||
outputs = [ "$target_out_dir/${_target_name_}/" ]
|
||||
}
|
||||
}
|
||||
|
||||
template("host_quickfix_test_action") {
|
||||
_target_name_ = "${target_name}"
|
||||
_extra_patches_ = invoker.extra_patches
|
||||
|
||||
_test_js_path_ = [
|
||||
"./${_target_name_}/base.js",
|
||||
"./${_target_name_}/module.js",
|
||||
"./${_target_name_}/patch/base.js",
|
||||
"./${_target_name_}/patch/module.js",
|
||||
"./${_target_name_}/test.js",
|
||||
]
|
||||
|
||||
foreach(patch, _extra_patches_) {
|
||||
_test_js_path_ += [
|
||||
"./${_target_name_}/${patch}/base.js",
|
||||
"./${_target_name_}/${patch}/module.js",
|
||||
]
|
||||
}
|
||||
|
||||
_base_merge_file_raw_ = "//arkcompiler/ets_runtime/test/quickfix/base.txt"
|
||||
_test_merge_file_raw_ = "//arkcompiler/ets_runtime/test/quickfix/test.txt"
|
||||
_retest_merge_file_raw_ = "//arkcompiler/ets_runtime/test/quickfix/retest.txt"
|
||||
|
||||
_base_merge_file_ = "$target_out_dir/${_target_name_}/base.txt"
|
||||
_test_merge_file_ = "$target_out_dir/${_target_name_}/test.txt"
|
||||
_retest_merge_file_ = "$target_out_dir/${_target_name_}/retest.txt"
|
||||
_patch_merge_file_ = "$target_out_dir/${_target_name_}/patch.txt"
|
||||
|
||||
_base_abc_path_ = "$target_out_dir/${_target_name_}/base.abc"
|
||||
_test_abc_path_ = "$target_out_dir/${_target_name_}/test.abc"
|
||||
_retest_abc_path_ = "$target_out_dir/${_target_name_}/retest.abc"
|
||||
_patch_abc_path_ = "$target_out_dir/${_target_name_}/patch/base.abc"
|
||||
|
||||
_test_expect_path_ = "./${_target_name_}/expect_output.txt"
|
||||
|
||||
action("gen_${_target_name_}_base_merge_file") {
|
||||
script = "//arkcompiler/ets_runtime/test/quickfix/generate_merge_file.py"
|
||||
args = [
|
||||
"--input",
|
||||
rebase_path(_base_merge_file_raw_),
|
||||
"--output",
|
||||
rebase_path(_base_merge_file_),
|
||||
"--prefix",
|
||||
rebase_path("//arkcompiler/ets_runtime/test/quickfix/${_target_name_}/"),
|
||||
]
|
||||
|
||||
inputs = [ _base_merge_file_raw_ ]
|
||||
outputs = [ _base_merge_file_ ]
|
||||
}
|
||||
|
||||
action("gen_${_target_name_}_test_merge_file") {
|
||||
script = "//arkcompiler/ets_runtime/test/quickfix/generate_merge_file.py"
|
||||
args = [
|
||||
"--input",
|
||||
rebase_path(_test_merge_file_raw_),
|
||||
"--output",
|
||||
rebase_path(_test_merge_file_),
|
||||
"--prefix",
|
||||
rebase_path("//arkcompiler/ets_runtime/test/quickfix/${_target_name_}/"),
|
||||
]
|
||||
|
||||
inputs = [ _test_merge_file_raw_ ]
|
||||
outputs = [ _test_merge_file_ ]
|
||||
}
|
||||
|
||||
action("gen_${_target_name_}_retest_merge_file") {
|
||||
script = "//arkcompiler/ets_runtime/test/quickfix/generate_merge_file.py"
|
||||
args = [
|
||||
"--input",
|
||||
rebase_path(_retest_merge_file_raw_),
|
||||
"--output",
|
||||
rebase_path(_retest_merge_file_),
|
||||
"--prefix",
|
||||
rebase_path("//arkcompiler/ets_runtime/test/quickfix/${_target_name_}/"),
|
||||
]
|
||||
|
||||
inputs = [ _retest_merge_file_raw_ ]
|
||||
outputs = [ _retest_merge_file_ ]
|
||||
}
|
||||
|
||||
action("gen_${_target_name_}_patch_merge_file") {
|
||||
script = "//arkcompiler/ets_runtime/test/quickfix/generate_merge_file.py"
|
||||
args = [
|
||||
"--input",
|
||||
rebase_path(_base_merge_file_raw_),
|
||||
"--output",
|
||||
rebase_path(_patch_merge_file_),
|
||||
"--prefix",
|
||||
rebase_path(
|
||||
"//arkcompiler/ets_runtime/test/quickfix/${_target_name_}/patch/"),
|
||||
]
|
||||
|
||||
inputs = [ _base_merge_file_raw_ ]
|
||||
outputs = [ _patch_merge_file_ ]
|
||||
}
|
||||
|
||||
es2abc_gen_abc("gen_${_target_name_}_base_abc") {
|
||||
extra_visibility = [ ":*" ] # Only targets in this file can depend on this.
|
||||
extra_dependencies = [ ":gen_${_target_name_}_base_merge_file" ]
|
||||
src_js = "@" + rebase_path(_base_merge_file_)
|
||||
dst_file = rebase_path(_base_abc_path_)
|
||||
extra_args = []
|
||||
extra_args += [ "--module" ]
|
||||
extra_args += [ "--merge-abc" ]
|
||||
|
||||
in_puts = [ _test_expect_path_ ]
|
||||
in_puts += _test_js_path_
|
||||
out_puts = [ _base_abc_path_ ]
|
||||
}
|
||||
|
||||
es2abc_gen_abc("gen_${_target_name_}_test_abc") {
|
||||
extra_visibility = [ ":*" ] # Only targets in this file can depend on this.
|
||||
extra_dependencies = [ ":gen_${_target_name_}_test_merge_file" ]
|
||||
src_js = "@" + rebase_path(_test_merge_file_)
|
||||
dst_file = rebase_path(_test_abc_path_)
|
||||
extra_args = []
|
||||
extra_args += [ "--module" ]
|
||||
extra_args += [ "--merge-abc" ]
|
||||
|
||||
in_puts = [ _test_expect_path_ ]
|
||||
in_puts += _test_js_path_
|
||||
out_puts = [ _test_abc_path_ ]
|
||||
}
|
||||
|
||||
es2abc_gen_abc("gen_${_target_name_}_retest_abc") {
|
||||
extra_visibility = [ ":*" ] # Only targets in this file can depend on this.
|
||||
extra_dependencies = [ ":gen_${_target_name_}_retest_merge_file" ]
|
||||
src_js = "@" + rebase_path(_retest_merge_file_)
|
||||
dst_file = rebase_path(_retest_abc_path_)
|
||||
extra_args = []
|
||||
extra_args += [ "--module" ]
|
||||
extra_args += [ "--merge-abc" ]
|
||||
|
||||
in_puts = [ _test_expect_path_ ]
|
||||
in_puts += _test_js_path_
|
||||
out_puts = [ _retest_abc_path_ ]
|
||||
}
|
||||
|
||||
es2abc_gen_abc("gen_${_target_name_}_patch_abc") {
|
||||
extra_visibility = [ ":*" ] # Only targets in this file can depend on this.
|
||||
extra_dependencies = [ ":gen_${_target_name_}_patch_merge_file" ]
|
||||
src_js = "@" + rebase_path(_patch_merge_file_)
|
||||
dst_file = rebase_path(_patch_abc_path_)
|
||||
extra_args = []
|
||||
extra_args += [ "--module" ]
|
||||
extra_args += [ "--merge-abc" ]
|
||||
|
||||
in_puts = [ _test_expect_path_ ]
|
||||
in_puts += _test_js_path_
|
||||
out_puts = [ _patch_abc_path_ ]
|
||||
}
|
||||
|
||||
_script_args_ =
|
||||
rebase_path(_base_abc_path_) + ":" + rebase_path(_test_abc_path_) + ":" +
|
||||
rebase_path(_retest_abc_path_) + ":" + rebase_path(_patch_abc_path_)
|
||||
|
||||
foreach(patch, _extra_patches_) {
|
||||
_merge_file_ = "$target_out_dir/${_target_name_}/${patch}.txt"
|
||||
_abc_file_ = "$target_out_dir/${_target_name_}/${patch}/base.abc"
|
||||
action("gen_${_target_name_}_${patch}_merge_file") {
|
||||
script = "//arkcompiler/ets_runtime/test/quickfix/generate_merge_file.py"
|
||||
args = [
|
||||
"--input",
|
||||
rebase_path(_base_merge_file_raw_),
|
||||
"--output",
|
||||
rebase_path(_merge_file_),
|
||||
"--prefix",
|
||||
rebase_path(
|
||||
"//arkcompiler/ets_runtime/test/quickfix/${_target_name_}/${patch}/"),
|
||||
]
|
||||
|
||||
inputs = [ _base_merge_file_raw_ ]
|
||||
outputs = [ _merge_file_ ]
|
||||
}
|
||||
|
||||
es2abc_gen_abc("gen_${_target_name_}_${patch}_abc") {
|
||||
extra_visibility =
|
||||
[ ":*" ] # Only targets in this file can depend on this.
|
||||
extra_dependencies = [ ":gen_${_target_name_}_${patch}_merge_file" ]
|
||||
src_js = "@" + rebase_path(_merge_file_)
|
||||
dst_file = rebase_path(_abc_file_)
|
||||
extra_args = []
|
||||
extra_args += [ "--module" ]
|
||||
extra_args += [ "--merge-abc" ]
|
||||
|
||||
in_puts = [ _test_expect_path_ ]
|
||||
in_puts += _test_js_path_
|
||||
out_puts = [ _abc_file_ ]
|
||||
}
|
||||
|
||||
_script_args_ += ":" + rebase_path(_abc_file_)
|
||||
}
|
||||
|
||||
action("${_target_name_}QuickfixAction") {
|
||||
testonly = true
|
||||
|
||||
_host_quickfix_target_ = "//arkcompiler/ets_runtime/ecmascript/quick_fix:quick_fix(${host_toolchain})"
|
||||
_root_out_dir_ = get_label_info(_host_quickfix_target_, "root_out_dir")
|
||||
deps = [
|
||||
":gen_${_target_name_}_base_abc",
|
||||
":gen_${_target_name_}_patch_abc",
|
||||
":gen_${_target_name_}_retest_abc",
|
||||
":gen_${_target_name_}_test_abc",
|
||||
_host_quickfix_target_,
|
||||
]
|
||||
foreach(patch, _extra_patches_) {
|
||||
deps += [ ":gen_${_target_name_}_${patch}_abc" ]
|
||||
}
|
||||
|
||||
script = "//arkcompiler/ets_runtime/script/run_ark_executable.py"
|
||||
|
||||
quickfix_options = " --merge-abc true --log-level info "
|
||||
|
||||
args = [
|
||||
"--script-file",
|
||||
rebase_path(_root_out_dir_) + "/ark/ark_js_runtime/quick_fix",
|
||||
"--script-options",
|
||||
quickfix_options,
|
||||
"--script-args",
|
||||
_script_args_,
|
||||
"--timeout-limit",
|
||||
"120",
|
||||
"--expect-file",
|
||||
rebase_path(_test_expect_path_),
|
||||
"--env-path",
|
||||
rebase_path(_root_out_dir_) + "/ark/ark:" + rebase_path(_root_out_dir_) +
|
||||
"/ark/ark_js_runtime:" + rebase_path(_root_out_dir_) +
|
||||
"/${_icu_path_}:" + rebase_path(_root_out_dir_) +
|
||||
rebase_path("//prebuilts/clang/ohos/linux-x86_64/llvm/lib/"),
|
||||
]
|
||||
|
||||
inputs = [
|
||||
_base_abc_path_,
|
||||
_test_abc_path_,
|
||||
_retest_abc_path_,
|
||||
_patch_abc_path_,
|
||||
]
|
||||
|
||||
outputs = [ "$target_out_dir/${_target_name_}/" ]
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user