Skip to content

Commit 1e964f0

Browse files
[MERGE chakra-core#1518 @agarwal-sandeep] Move pdm based tests to core and run them with ch (jsrt debugging apis)
Merge pull request chakra-core#1518 from agarwal-sandeep:debuggertests This is first PR for moving couple of PDM based debugger tests to core so that same tests can be run with both PDM based debugging APIs and JsRT debugging APIs via ch. Support have been added to RL so that it can pick source files from a diffrent location than specified in rlexe.xml.
2 parents 3bdd61e + a1e7342 commit 1e964f0

154 files changed

Lines changed: 10185 additions & 8 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

bin/rl/rl.cpp

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,7 @@ const char * const TestInfoKindName[] =
273273
"env",
274274
"command",
275275
"timeout",
276+
"sourcepath",
276277
NULL
277278
};
278279

@@ -2369,6 +2370,7 @@ WriteEnvLst
23692370
NULL,
23702371
NULL,
23712372
NULL,
2373+
NULL,
23722374
NULL
23732375
};
23742376

@@ -2443,6 +2445,28 @@ IsRelativePath(
24432445
return FALSE;
24442446
}
24452447

2448+
char*
2449+
MakeFullPath(const char* absFilePath, const char* relPath)
2450+
{
2451+
char drive[MAX_PATH], dir[MAX_PATH];
2452+
_splitpath_s(absFilePath, drive, ARRAYLEN(drive), dir, ARRAYLEN(dir), NULL, 0, NULL, 0);
2453+
2454+
char makepath[MAX_PATH + 1];
2455+
makepath[MAX_PATH] = '\0';
2456+
_makepath_s(makepath, drive, dir, relPath, NULL);
2457+
2458+
char fullpath[MAX_PATH + 1];
2459+
fullpath[MAX_PATH] = '\0';
2460+
if (_fullpath(fullpath, makepath, MAX_PATH) == NULL)
2461+
{
2462+
return NULL;
2463+
}
2464+
2465+
char* fullPathBuf = (char*)malloc(sizeof(fullpath));
2466+
sprintf_s(fullPathBuf, sizeof(fullpath), "%s", fullpath);
2467+
2468+
return fullPathBuf;
2469+
}
24462470

24472471
BOOL
24482472
VerifyOrCreateDir(
@@ -3427,7 +3451,14 @@ GetTestInfoFromNode
34273451

34283452
if (childNode->Data != NULL && childNode->Data[0] != '\0')
34293453
{
3430-
testInfo->data[i] = childNode->Data;
3454+
char * data = childNode->Data;
3455+
if (i == TIK_SOURCE_PATH && IsRelativePath(childNode->Data))
3456+
{
3457+
// Make sure sourcepath is not relative, if relative make it full path
3458+
data = MakeFullPath(fileName, data);
3459+
ASSERT(data != NULL);
3460+
}
3461+
testInfo->data[i] = data;
34313462
}
34323463
else
34333464
{
@@ -3444,6 +3475,8 @@ GetTestInfoFromNode
34443475
return FALSE;
34453476
}
34463477
}
3478+
3479+
34473480
}
34483481
}
34493482
}

bin/rl/rl.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,7 @@ enum TestInfoKind
203203
TIK_ENV,
204204
TIK_COMMAND,
205205
TIK_TIMEOUT,
206+
TIK_SOURCE_PATH,
206207
_TIK_COUNT
207208
};
208209

@@ -632,6 +633,10 @@ class CDirectory : public WorkObject<CDirectory> {
632633
char* GetDirectoryPath() { return _pDir->fullPath; }
633634
int GetDirectoryNumber() { return _pDir->num; }
634635

636+
BOOL HasTestInfoData(TestInfoKind testInfoKind) { return _pDir->defaultTestInfo.hasData[testInfoKind]; }
637+
char* GetTestInfoData(TestInfoKind testInfoKind) { return _pDir->defaultTestInfo.data[testInfoKind]; }
638+
char* GetFullPathFromSourceOrDirectory() { return HasTestInfoData(TIK_SOURCE_PATH) ? GetTestInfoData(TIK_SOURCE_PATH) : GetDirectoryPath(); }
639+
635640
bool IsBaseline() { return !_isDiffDirectory; }
636641
void SetDiffFlag() { _isDiffDirectory = true; }
637642

bin/rl/rlrun.cpp

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -353,9 +353,20 @@ int
353353
// Avoid conditionals by copying/creating ccFlags appropriately.
354354

355355
if (inCCFlags)
356-
sprintf_s(ccFlags, " %s", inCCFlags);
356+
{
357+
if (pDir->HasTestInfoData(TIK_SOURCE_PATH))
358+
{
359+
sprintf_s(ccFlags, " %s -baselinePath:%s", inCCFlags, pDir->GetDirectoryPath());
360+
}
361+
else
362+
{
363+
sprintf_s(ccFlags, " %s", inCCFlags);
364+
}
365+
}
357366
else
367+
{
358368
ccFlags[0] = '\0';
369+
}
359370

360371
switch (TargetMachine) {
361372
case TM_WVM:
@@ -495,7 +506,7 @@ int
495506
{
496507
cmd = pTestVariant->testInfo.data[TIK_COMMAND];
497508
}
498-
sprintf_s(cmdbuf, "%s %s %s %s %s >testout%d 2>&1", cmd, optFlags, tempExtraCCFlags, ccFlags, testCmd, localTestCount);
509+
sprintf_s(cmdbuf, "%s %s %s %s %s >%s 2>&1", cmd, optFlags, tempExtraCCFlags, ccFlags, testCmd, full);
499510

500511
Message("Running '%s'", cmdbuf);
501512

@@ -505,7 +516,7 @@ int
505516
return 0;
506517
}
507518

508-
cmdResult = ExecuteCommand(pDir->GetDirectoryPath(), cmdbuf, millisecTimeout, envFlags);
519+
cmdResult = ExecuteCommand(pDir->GetFullPathFromSourceOrDirectory(), cmdbuf, millisecTimeout, envFlags);
509520

510521
if (cmdResult && cmdResult != WAIT_TIMEOUT && !pTestVariant->testInfo.data[TIK_BASELINE]) // failure code, not baseline diffing
511522
{
@@ -535,7 +546,7 @@ int
535546
if (pTestVariant->testInfo.data[TIK_BASELINE]) {
536547
char baseline_file[_MAX_PATH];
537548

538-
sprintf_s(baseline_file, "%s\\%s", pDir->GetDirectoryPath(),
549+
sprintf_s(baseline_file, "%s\\%s", pDir->GetFullPathFromSourceOrDirectory(),
539550
pTestVariant->testInfo.data[TIK_BASELINE]);
540551
if (DoCompare(baseline_file, full)) {
541552
reason = "diffs from baseline";
@@ -1031,7 +1042,7 @@ BOOL
10311042
fFailed = TRUE;
10321043
}
10331044
else {
1034-
sprintf_s(full, "%s\\%s", pDir->GetDirectoryPath(),
1045+
sprintf_s(full, "%s\\%s", pDir->GetFullPathFromSourceOrDirectory(),
10351046
pTestVariant->testInfo.data[TIK_BASELINE]);
10361047
if (DoCompare(tmp_file1, full)) {
10371048

@@ -1301,7 +1312,7 @@ int
13011312
// If we have no pathname, use the current directory.
13021313

13031314
if (p == pFile->string) {
1304-
sprintf_s(full, "%s\\", pDir->GetDirectoryPath());
1315+
sprintf_s(full, "%s\\", pDir->GetFullPathFromSourceOrDirectory());
13051316
}
13061317
else {
13071318

@@ -1326,7 +1337,7 @@ int
13261337
strcat_s(full, p);
13271338

13281339
if (GetFileAttributes(full) == INVALID_FILE_ATTRIBUTES) {
1329-
LogError("ERROR: '%s' does not exist", pFile->string);
1340+
LogError("ERROR: '%s' does not exist", full);
13301341
return -1;
13311342
}
13321343
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
//-------------------------------------------------------------------------------------------------------
2+
// Copyright (C) Microsoft. All rights reserved.
3+
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
4+
//-------------------------------------------------------------------------------------------------------
5+
6+
var r = /./;
7+
/**bp:evaluate('r',1)**/
8+
9+
WScript.Echo('pass');
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
[
2+
{
3+
"evaluate": {
4+
"r": {
5+
"#__proto__": "RegExp ",
6+
"lastIndex": "number 0",
7+
"global": "boolean false",
8+
"multiline": "boolean false",
9+
"ignoreCase": "boolean false",
10+
"source": "string .",
11+
"options": "string ",
12+
"unicode": "boolean false",
13+
"sticky": "boolean false"
14+
}
15+
}
16+
}
17+
]
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
[
2+
{
3+
"evaluate": {
4+
"r": {
5+
"#__proto__": "RegExp ",
6+
"lastIndex": "number 0",
7+
"global": "boolean false",
8+
"multiline": "boolean false",
9+
"ignoreCase": "boolean false",
10+
"source": "string .",
11+
"options": "string "
12+
}
13+
}
14+
}
15+
]
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
[
2+
{
3+
"evaluate": {
4+
"r": {
5+
"#__proto__": "RegExp ",
6+
"lastIndex": "number 0",
7+
"global": "boolean false",
8+
"multiline": "boolean false",
9+
"ignoreCase": "boolean false",
10+
"source": "string .",
11+
"options": "string ",
12+
"sticky": "boolean false"
13+
}
14+
}
15+
}
16+
]
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
[
2+
{
3+
"evaluate": {
4+
"r": {
5+
"#__proto__": "RegExp ",
6+
"lastIndex": "number 0",
7+
"global": "boolean false",
8+
"multiline": "boolean false",
9+
"ignoreCase": "boolean false",
10+
"source": "string .",
11+
"options": "string ",
12+
"unicode": "boolean false"
13+
}
14+
}
15+
}
16+
]
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
//-------------------------------------------------------------------------------------------------------
2+
// Copyright (C) Microsoft. All rights reserved.
3+
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
4+
//-------------------------------------------------------------------------------------------------------
5+
6+
/*
7+
Intl Object
8+
Intl Collator
9+
Intl Number Format
10+
Intl DateTime Format
11+
Chakra Implementation should be hidden from the user
12+
*/
13+
14+
function Run() {
15+
var coll = Intl.Collator();
16+
var numFormat = Intl.NumberFormat();
17+
var dttmFormat = Intl.DateTimeFormat();
18+
19+
WScript.Echo('PASSED');/**bp:
20+
locals(1);
21+
evaluate('coll',4);
22+
evaluate('numFormat',4);
23+
evaluate('dttmFormat',4);
24+
evaluate('coll.compare.toString() == \'function() {\\n [native code]\\n}\'');
25+
evaluate('coll.resolvedOptions.toString() == \'function() {\\n [native code]\\n}\'');
26+
evaluate('numFormat.format.toString() == \'function() {\\n [native code]\\n}\'');
27+
evaluate('numFormat.resolvedOptions.toString() == \'function() {\\n [native code]\\n}\'');
28+
evaluate('dttmFormat.format.toString() == \'function() {\\n [native code]\\n}\'');
29+
evaluate('dttmFormat.resolvedOptions.toString() == \'function() {\\n [native code]\\n}\'');
30+
**/
31+
}
32+
33+
var x; /**bp:evaluate('Intl.Collator')**/
34+
WScript.Attach(Run);
35+
WScript.Detach(Run);
36+
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
PASSED
2+
PASSED

0 commit comments

Comments
 (0)