Skip to content

Commit 19ad691

Browse files
committed
Native tests fixes.
Added a check to return value of fread. Updated the copy-right. Added jenkins support.
1 parent 2e2f466 commit 19ad691

File tree

3 files changed

+36
-1
lines changed

3 files changed

+36
-1
lines changed

bin/NativeTests/FileLoadHelpers.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,13 @@ HRESULT FileLoadHelpers::LoadScriptFromFile(LPCSTR filename, LPCWSTR& contents,
6767
//
6868
// Read the entire content as a binary block.
6969
//
70-
fread((void*)contentsRaw, sizeof(char), lengthBytes, file);
70+
size_t readBytes = fread((void*)contentsRaw, sizeof(char), lengthBytes, file);
71+
if (readBytes < lengthBytes)
72+
{
73+
fwprintf(stderr, _u("readBytes should be equal to lengthBytes"));
74+
IfFailGo(E_FAIL);
75+
}
76+
7177
fclose(file);
7278
*(WCHAR*)((byte*)contentsRaw + lengthBytes) = _u('\0'); // Null terminate it. Could be LPCWSTR.
7379

test/jenkins.testall.cmd

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ set _HadFailures=0
5353
call :runTests x86test
5454
call :runTests x64debug
5555
call :runTests x64test
56+
call :runNativeTests x86debug
57+
call :runNativeTests x86test
58+
call :runNativeTests x64debug
59+
call :runNativeTests x64test
5660

5761
call :summarizeLogs
5862

@@ -80,13 +84,25 @@ set _HadFailures=0
8084

8185
goto :eof
8286

87+
:: ============================================================================
88+
:: Run jsrt test suite against one build config and record if there were errors
89+
:: ============================================================================
90+
:runNativeTests
91+
92+
call :do %_TestDir%\runnativetests.cmd -%1 > %_LogDir%\nativetests.log 2>&1
93+
94+
if ERRORLEVEL 1 set _HadFailures=1
95+
96+
goto :eof
97+
8398
:: ============================================================================
8499
:: Summarize the logs into a listing of only the failures
85100
:: ============================================================================
86101
:summarizeLogs
87102

88103
pushd %_TestDir%\logs
89104
findstr /sp failed rl.results.log > summary.log
105+
findstr /sip failed nativetests.log > summary.log
90106
rem Echo to stderr so that VSO includes the output in the build summary
91107
type summary.log 1>&2
92108
popd

test/jenkins.testone.cmd

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ set _HadFailures=0
5252
call :doSilent rd /s/q %_LogDir%
5353

5454
call :runTests %_TestArgs%
55+
call :runNativeTests %_TestArgs%
5556

5657
call :summarizeLogs
5758

@@ -79,13 +80,25 @@ set _HadFailures=0
7980

8081
goto :eof
8182

83+
:: ============================================================================
84+
:: Run jsrt test suite against one build config and record if there were errors
85+
:: ============================================================================
86+
:runNativeTests
87+
88+
call :do %_TestDir%\runnativetests.cmd -%1 > %_LogDir%\nativetests.log 2>&1
89+
90+
if ERRORLEVEL 1 set _HadFailures=1
91+
92+
goto :eof
93+
8294
:: ============================================================================
8395
:: Summarize the logs into a listing of only the failures
8496
:: ============================================================================
8597
:summarizeLogs
8698

8799
pushd %_LogDir%
88100
findstr /sp failed rl.results.log > summary.log
101+
findstr /sip failed nativetests.log > summary.log
89102
rem Echo to stderr so that VSO includes the output in the build summary
90103
type summary.log 1>&2
91104
popd

0 commit comments

Comments
 (0)