Skip to content

Commit f295508

Browse files
committedJan 12, 2016
[MERGE chakra-core#37] Add a Jenkins task to check for correct Microsoft Copyright notices.
Merge pull request chakra-core#37 from dilijev:copy Add a Jenkins task to check for a correct Microsoft Copyright notice in all modified source files.
2 parents 5b4afff + f6adc7f commit f295508

26 files changed

+225
-226
lines changed
 

‎Build/scripts/check_prefast_error.ps1

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
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+
#-------------------------------------------------------------------------------------------------------
15

26
param (
37
[string]$directory,

‎Build/scripts/post_build.ps1

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
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+
16
param (
27
[ValidateSet("x86", "x64", "arm", "*")]
38
[string]$arch="*",

‎Build/scripts/pre_build.ps1

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
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+
16
#
27
# Pre-Build script
38
#

‎Build/scripts/pre_post_util.ps1

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
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+
16
. "$PSScriptRoot\util.ps1"
27

38
function UseValueOrDefault($value, $defaultvalue, $defaultvalue2) {

‎Build/scripts/util.ps1

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
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+
16
function WriteMessage($str)
27
{
38
Write-Output $str

‎bin/ch/CodexAssert.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
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+
16
#include "stdafx.h"
27

38
// The Codex library requires this assertion.

‎jenkins.check_copyright.py

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
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+
# Python 2.7
7+
8+
import sys
9+
import os.path
10+
import re
11+
12+
copyright_lines = [
13+
r'-------------------------------------------------------------------------------------------------------',
14+
r' Copyright \(C\) Microsoft\. All rights reserved\.',
15+
r' Licensed under the MIT license\. See LICENSE\.txt file in the project root for full license information\.'
16+
]
17+
18+
regexes = []
19+
for line in copyright_lines:
20+
pattern = '^.{1,5}%s$' % line
21+
regexes.append(re.compile(pattern))
22+
23+
if len(sys.argv) < 2:
24+
print "Requires passing a filename as an argument."
25+
exit(1)
26+
27+
file_name = sys.argv[1]
28+
if not os.path.isfile(file_name):
29+
print "File does not exist:", file_name
30+
exit(1)
31+
32+
with open(file_name, 'r') as sourcefile:
33+
for x in range(0,4):
34+
# TODO add a check for empty files (dummy.js etc), as they cause the script to crash here
35+
line = next(sourcefile)
36+
line = line.rstrip()
37+
matches = regexes[x].match(line)
38+
if not matches:
39+
print file_name, "... does not contain a correct Microsoft copyright notice."
40+
# found a problem so exit and report the problem to the caller
41+
exit(1)

‎jenkins.check_copyright.sh

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
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+
# Need to make sure that the reference to origin/master is available.
7+
# We know that HEAD is checked out so that the tests on that source can be run.
8+
9+
# configure the sh environment to run scripts from the bin dir in case that's missing
10+
ls &> /dev/null # checking for ls script on the path
11+
if [ $? -ne 0 ]; then
12+
PATH=/bin:/usr/bin:$PATH
13+
fi
14+
15+
ERRFILE=jenkins.check_eol.sh.err
16+
rm -f $ERRFILE
17+
18+
git diff --name-only `git merge-base origin/master HEAD` HEAD |
19+
grep -v -E '\.git.*' |
20+
grep -v -E '\.xml$' |
21+
grep -v -E '\.props$' |
22+
grep -v -E '\.md$' |
23+
grep -v -E '\.txt$' |
24+
grep -v -E '\.baseline$' |
25+
grep -v -E '\.sln$' |
26+
grep -v -E '\.vcxproj$' |
27+
grep -v -E '\.filters$' |
28+
grep -v -E '\.targets$' |
29+
grep -v -E '\.def$' |
30+
grep -v -E '\.inc$' |
31+
grep -v -E 'test/benchmarks/.*\.js$' |
32+
xargs -I % sh -c "echo Checking %; python jenkins.check_copyright.py % >> $ERRFILE"
33+
34+
if [ -e $ERRFILE ]; then # if error file exists then there were errors
35+
>&2 echo "--------------" # leading >&2 means echo to stderr
36+
>&2 echo "--- ERRORS ---"
37+
cat $ERRFILE 1>&2 # send output to stderr so it can be redirected as error if desired
38+
>&2 echo "--------------"
39+
exit 1 # tell the caller there was an error (so Jenkins will fail the CI task)
40+
else
41+
echo "--- NO PROBLEMS DETECTED ---"
42+
fi

‎jenkins.check_eol.sh

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
# Need to make sure that the reference to master is available.
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+
# Need to make sure that the reference to origin/master is available.
27
# We know that HEAD is checked out so that the tests on that source can be run.
38

49
# configure the sh environment to run scripts from the bin dir in case that's missing

‎jenkins.check_file_eol.sh

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
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+
16
# We will run dos2unix on the argument and make sure that it doesn't change.
27
# If it changes, that means someone introduced a CRLF by not setting core.autocrlf to true.
38

‎lib/Runtime/Base/ThreadConfigFlagsList.h

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
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+
16
// Format: FLAG*(ThreadFlag, GlobalFlag)
27
FLAG(IsCollectGarbageEnabled, CollectGarbage)
38
FLAG(IsErrorStackTraceEnabled, errorStackTrace)

‎lib/Runtime/Library/InJavascript/GenByteCode.cmd

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
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+
16
@echo off
27
setlocal
38
set _HASERROR=0
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
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+
16
call %*
27
cd %JSCRIPT_ROOT%
38
build -cz -dir inetcore\jscript\manifests;inetcore\jscript\lib\author;inetcore\jscript\lib\backend;inetcore\jscript\lib\common;inetcore\jscript\lib\parser;inetcore\jscript\lib\runtime\bytecode;inetcore\jscript\lib\runtime\math;inetcore\jscript\lib\runtime\language;inetcore\jscript\lib\runtime\library;inetcore\jscript\lib\runtime\types;inetcore\jscript\lib\winrt;inetcore\jscript\dll\jscript\test;inetcore\jscript\exe\common;inetcore\jscript\exe\jshost\release

‎lib/common/Memory/ValidPointersMap/GenValidPointersMap.cmd

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
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+
16
@echo off
27
setlocal
38
set _FILE=

‎netci.groovy

+24
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
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+
16
// Import the utility functionality.
27
import jobs.generation.Utilities;
38
import jobs.generation.InternalUtilities;
@@ -241,3 +246,22 @@ def msbuildTypeMap = [
241246
// Add private permissions for certain users
242247
InternalUtilities.addPrivatePermissions(newJob, ['nmostafa', 'arunetm', 'litian2025'])
243248
}
249+
250+
// Create a job to check that all source files have the correct Microsoft copyright notice.
251+
// Note: it is not necessary to run this job daily.
252+
[true, false].each { isPR -> // Defines a closure over true and false, value assigned to isPR
253+
def jobName = InternalUtilities.getFullJobName(project, 'ubuntu_check_copyright', isPR)
254+
255+
def taskString = './jenkins.check_copyright.sh'
256+
def newJob = job(jobName) {
257+
label('ubuntu')
258+
steps {
259+
shell(taskString)
260+
}
261+
}
262+
263+
// Note: InternalUtilities variant also sets private permission
264+
InternalUtilities.simpleInnerLoopJobSetup(newJob, project, isPR, "Copyright Check")
265+
// Add private permissions for certain users
266+
InternalUtilities.addPrivatePermissions(newJob, ['nmostafa', 'arunetm', 'litian2025'])
267+
}

‎test/Array/bug4916987.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
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+
16
//Baseline switches:
27
//Switches: -mic:1 -off:simplejit
38
var Float64ArrayView = new Float64Array();
@@ -24,4 +29,3 @@ if (Float64ArrayView[4] === val && Int32ArrayView[4] === (val | 0)) {
2429
print(Int32ArrayView[4]);
2530
print("FAILED");
2631
}
27-

‎test/AsmJs/RunCompare.cmd

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
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+
16
@echo off
27
setlocal ENABLEDELAYEDEXPANSION
38

‎test/AsmJs/RunTest.cmd

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
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+
16
@echo off
27
setlocal ENABLEDELAYEDEXPANSION
38

‎test/Generated/createBaseLine.bat

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
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+
16
cscript.exe //nologo mul.js > mul.baseline
27
cscript.exe //nologo mul0.js > mul0.baseline
38
cscript.exe //nologo mul1.js > mul1.baseline

‎test/SIMD.workloads.asmjs/testLinearSearch.js

+13-8
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
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+
16
function InitBuffer1(buffer) {
27
HEAP32 = new Int32Array(buffer);
38
HEAP32[0] = 13654
@@ -21,39 +26,39 @@ function InitBuffer2(buffer) {
2126

2227
function asmModule(stdlib, imports, buffer) {
2328
"use asm";
24-
29+
2530
var log = stdlib.Math.log;
26-
31+
2732
var i4 = stdlib.SIMD.Int32x4;
2833
var i4equal = i4.equal;
2934
var i4splat = i4.splat;
3035
var i4swizzle = i4.swizzle;
31-
36+
3237
var HEAP32 = new stdlib.Int32Array(buffer);
3338
var BLOCK_SIZE = 4;
3439
var i = 0;
35-
40+
3641
function linearSearch(value, length) {
3742
value = value | 0;
3843
length = length|0;
3944
var i4Value = i4(0, 0, 0, 0);
4045
var i4Heap = i4(0, 0, 0, 0);
4146
var i4Result = i4(0, 0, 0, 0);
4247
var i4Flipped = i4(0, 0, 0, 0);
43-
48+
4449
i4Value = i4splat(value | 0);
4550
for(i = 0; (i | 0) < (length | 0); i = (i + BLOCK_SIZE) | 0) {
4651
i4Heap = i4((HEAP32[(i << 2) >> 2] | 0), (HEAP32[((i + 1) << 2) >> 2] | 0), (HEAP32[((i + 2) << 2) >> 2] | 0), (HEAP32[((i + 3) << 2) >> 2] | 0));
4752
i4Result = i4equal(i4Heap, i4Value);
48-
53+
4954
if(i4Result.signMask != 0) {
5055
i4Flipped = i4swizzle(i4Result, 3, 2, 1, 0);
5156
return (i + BLOCK_SIZE - ~~(log(+(i4Flipped.signMask|0)) / log(2.0)) - 1)|0
5257
}
5358
}
5459
return -1;
5560
}
56-
61+
5762
return {linearSearch:linearSearch};
5863
}
5964

@@ -73,4 +78,4 @@ WScript.Echo("List 2");
7378
WScript.Echo(m.linearSearch(13654, 999999));
7479
WScript.Echo(m.linearSearch(23, 999999));
7580
WScript.Echo(m.linearSearch(145764, 999999));
76-
WScript.Echo(m.linearSearch(-53, 999999));
81+
WScript.Echo(m.linearSearch(-53, 999999));

‎test/UnifiedRegex/prelude

-214
This file was deleted.

‎test/rltimeout/longrunning.js

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
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+
16
var seconds = 0;
27
function finish() {
38
print('pass');

‎test/rltimeout/mediumrunning.js

+5
Original file line numberDiff line numberDiff line change
@@ -1 +1,6 @@
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+
16
WScript.SetTimeout(function () { print('pass'); }, 20000);

‎test/rltimeout/runjsfile.cmd

+5
Original file line numberDiff line numberDiff line change
@@ -1 +1,6 @@
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+
16
ch.exe %1

‎test/rltimeout/shortrunning.js

+5
Original file line numberDiff line numberDiff line change
@@ -1 +1,6 @@
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+
16
WScript.SetTimeout(function () { print('pass'); }, 500);

‎test/stackfunc/genbaseline.cmd

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
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+
16
@echo off
27
setlocal
38
IF "%1" == "" (
@@ -45,5 +50,3 @@ IF NOT "%ERRORLEVEL%" == "0" (
4550
sd edit %2
4651
copy __temp.out %2
4752
)
48-
49-

0 commit comments

Comments
 (0)
Please sign in to comment.