add script to set copyright header for source files

this works for:
- C/C++ files
- files where comment is #

Change include set of simple tests.

Change-Id: I1c08c6c359e2a48957d5d81397c439508ae06c42
Signed-off-by: Artur Harasimiuk <artur.harasimiuk@intel.com>
This commit is contained in:
Artur Harasimiuk
2018-09-13 16:26:01 +02:00
parent 65dc5fb7de
commit 8334d424ba
26 changed files with 365 additions and 66 deletions

View File

@@ -0,0 +1,3 @@
/*
* No copyright at all
*/

View File

@@ -0,0 +1,4 @@
#!/bin/bash
echo 123

View File

@@ -0,0 +1,4 @@
/*
* Copyright (C) 2017 XYZ
*/

View File

@@ -0,0 +1,2 @@
#
# Copyright (C) 2017 XYZ

View File

@@ -0,0 +1,3 @@
//
// This comment shouldn't be removed
//

View File

@@ -0,0 +1,3 @@
#
# This comment shouldn't be removed
#

View File

@@ -0,0 +1,7 @@
/*
* No copyright at all
*/
#include "file.h"
class C;

View File

@@ -0,0 +1,7 @@
#
# No copyright at all
#
echo "file.h"
exit 1

View File

@@ -0,0 +1,5 @@
/*
* Copyright (C) 2012 - 2016 Intel Corporation
*
* No spdx header
*/

View File

@@ -0,0 +1,10 @@
/*
* Copyright (C) 2018 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
/*
* No copyright at all
*/

View File

@@ -0,0 +1,10 @@
#!/bin/bash
#
# Copyright (C) 2018 Intel Corporation
#
# SPDX-License-Identifier: MIT
#
echo 123

View File

@@ -0,0 +1,6 @@
/*
* Copyright (C) 2017-2018 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/

View File

@@ -0,0 +1,5 @@
#
# Copyright (C) 2017-2018 Intel Corporation
#
# SPDX-License-Identifier: MIT
#

View File

@@ -0,0 +1,10 @@
/*
* Copyright (C) 2018 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
//
// This comment shouldn't be removed
//

View File

@@ -0,0 +1,9 @@
#
# Copyright (C) 2018 Intel Corporation
#
# SPDX-License-Identifier: MIT
#
#
# This comment shouldn't be removed
#

View File

@@ -0,0 +1,14 @@
/*
* Copyright (C) 2018 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
/*
* No copyright at all
*/
#include "file.h"
class C;

View File

@@ -0,0 +1,13 @@
#
# Copyright (C) 2018 Intel Corporation
#
# SPDX-License-Identifier: MIT
#
#
# No copyright at all
#
echo "file.h"
exit 1

View File

@@ -0,0 +1,6 @@
/*
* Copyright (C) 2012-2018 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/

20
scripts/tests/copyright/test.sh Executable file
View File

@@ -0,0 +1,20 @@
#!/bin/sh
#
# Copyright (C) 2018 Intel Corporation
#
# SPDX-License-Identifier: MIT
#
#
# Simple, file based tests for copyright script
# script return non-zero error code if something went wrong.
# diff output is printed
#
python ../../lint/set_copyright.py in/*
for i in in/*
do
fn=$(basename $i)
diff -du in/$fn out/$fn
done