summaryrefslogtreecommitdiffstats
path: root/scripts/t
diff options
context:
space:
mode:
authorRohan McGovern <rohan.mcgovern@nokia.com>2012-01-19 11:55:51 +1000
committerQt by Nokia <qt-info@nokia.com>2012-01-20 02:24:35 +0100
commit230914798bc74da7a84f79ac00b64ea01c5d2257 (patch)
tree649b3c4021232ecb0cfec36a6bf18b2bebd71b36 /scripts/t
parent886803ab44e82f7437f2f961148de49ca05593a8 (diff)
Added selftest for license checker
The license checker needs to be updated to support some new forms of copyright information. Add an autotest first to guard against regressions, and to serve as documentation on the permitted license forms. Change-Id: I2ddf9264299f7211088f704d758d1ddf28462741 Sanity-Review: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
Diffstat (limited to 'scripts/t')
-rw-r--r--scripts/t/90-licenses.t120
-rw-r--r--scripts/t/license-testdata/bad/missing-license-info.qdoc12
-rw-r--r--scripts/t/license-testdata/bad/multiple-header-one-wrong.s128
-rw-r--r--scripts/t/license-testdata/bad/noheader.cpp1
-rw-r--r--scripts/t/license-testdata/bad/wrong-lgpl-nokia.sh42
-rw-r--r--scripts/t/license-testdata/expected-output.txt56
-rw-r--r--scripts/t/license-testdata/good/multiple-copyright-lgpl.g43
-rw-r--r--scripts/t/license-testdata/good/multiple-headers.cpp84
-rw-r--r--scripts/t/license-testdata/good/typical-bsd-nokia.cpp41
-rw-r--r--scripts/t/license-testdata/good/typical-fdl-nokia.qdoc28
-rw-r--r--scripts/t/license-testdata/good/typical-lgpl-nokia.cpp42
-rw-r--r--scripts/t/license-testdata/good/typical-lgpl-only-nokia.bat24
-rw-r--r--scripts/t/license-testdata/reference/header.BSD40
-rw-r--r--scripts/t/license-testdata/reference/header.FDL27
-rw-r--r--scripts/t/license-testdata/reference/header.LGPL41
-rw-r--r--scripts/t/license-testdata/reference/header.LGPL-ONLY22
16 files changed, 751 insertions, 0 deletions
diff --git a/scripts/t/90-licenses.t b/scripts/t/90-licenses.t
new file mode 100644
index 00000000..b939c247
--- /dev/null
+++ b/scripts/t/90-licenses.t
@@ -0,0 +1,120 @@
+#!/usr/bin/env perl
+use v5.10;
+use strict;
+use warnings;
+
+=head1 NAME
+
+90-licenses.t - selftest for license checker
+
+=head1 DESCRIPTION
+
+This autotest executes the license checker test (tst_licenses.pl)
+against various test files and verifies that good/bad license
+headers are correctly detected.
+
+The test uses the testdata under the `license-testdata' directory.
+
+=cut
+
+use Capture::Tiny qw(capture_merged);
+use Cwd qw(abs_path);
+use English qw(-no_match_vars);
+use File::Basename;
+use File::Copy;
+use File::Find;
+use File::Path;
+use File::Spec::Functions;
+use File::Slurp qw(read_file);
+use File::Temp;
+use FindBin;
+use Readonly;
+use Test::More;
+use Text::Diff;
+use autodie qw(:default copy);
+
+Readonly my %RE => (
+ # Match any lines in the output consisting of a comment, or empty lines.
+ insignificant_line => qr{^#[^\n]*\n|^\n}ms,
+
+ # Match the (irrelevant) test numbers
+ test_number => qr{(?<=ok )\d+},
+);
+
+sub copy_testdata
+{
+ my (%args) = @_;
+ my $tempdir = $args{ tempdir };
+ my $file = $args{ file };
+
+ return unless (-f $file);
+
+ my $dest = "$tempdir/$file";
+
+ my $destdir = dirname( $dest );
+ if (! -d $destdir) {
+ mkpath( $destdir );
+ }
+
+ copy( $file, $dest );
+ return;
+}
+
+sub main
+{
+ my $tst_licenses = abs_path(
+ catfile( $FindBin::Bin, qw(.. .. tests prebuild license tst_licenses.pl) )
+ );
+ ok( -f($tst_licenses), 'tst_licenses.pl exists' );
+
+ my $testdata = catfile( $FindBin::Bin, 'license-testdata' );
+ ok( -d($testdata), 'license-testdata exists' );
+
+ my $expected_output = read_file( catfile( $testdata, 'expected-output.txt' ) );
+
+ my $tempdir = File::Temp->newdir( basename($0)."-XXXXXX", TMPDIR => 1 );
+ diag "testing tst_licenses.pl under $tempdir";
+
+ # link $tempdir/qtbase to the reference header directory (used to find header.*)
+ symlink( "$testdata/reference", "$tempdir/qtbase" );
+
+ chdir $testdata;
+
+ # copy all our testdata into the tempdir;
+ # we have to copy it out of a git repository because, if pointed at a git repo,
+ # tst_licenses.pl will check the entire repo.
+ my @test_dirs = qw(bad good);
+ find({
+ no_chdir => 1,
+ wanted => sub {
+ copy_testdata( tempdir => $tempdir, file => $File::Find::name )
+ },
+ }, @test_dirs
+ );
+
+ # Now run the test
+ my $actual_output = capture_merged {
+ local $ENV{ QT_MODULE_TO_TEST } = $tempdir;
+ system( $EXECUTABLE_NAME, $tst_licenses );
+ };
+ # Remove all comments and test numbers before diff
+ $actual_output =~ s/$RE{ insignificant_line }//g;
+ $actual_output =~ s/$RE{ test_number }/x/g;
+ $expected_output =~ s/$RE{ insignificant_line }//g;
+ $expected_output =~ s/$RE{ test_number }/x/g;
+
+ my $diff = diff( \$expected_output, \$actual_output );
+ if (!ok( !$diff, "tst_licenses.pl output matches expected" )) {
+ diag(
+ "--- expected output of tst_licenses.pl\n"
+ ."+++ actual output of tst_licenses.pl\n"
+ .$diff
+ );
+ }
+
+ done_testing( );
+ return;
+}
+
+main if (!caller);
+1;
diff --git a/scripts/t/license-testdata/bad/missing-license-info.qdoc b/scripts/t/license-testdata/bad/missing-license-info.qdoc
new file mode 100644
index 00000000..50eaba0d
--- /dev/null
+++ b/scripts/t/license-testdata/bad/missing-license-info.qdoc
@@ -0,0 +1,12 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the (whatever) of the Qt Toolkit.
+**
+**
+****************************************************************************/
+
+// code goes here ...
diff --git a/scripts/t/license-testdata/bad/multiple-header-one-wrong.s b/scripts/t/license-testdata/bad/multiple-header-one-wrong.s
new file mode 100644
index 00000000..54f656f6
--- /dev/null
+++ b/scripts/t/license-testdata/bad/multiple-header-one-wrong.s
@@ -0,0 +1,128 @@
+;/****************************************************************************
+;**
+;** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+;** All rights reserved.
+;** Contact: Nokia Corporation (qt-info@nokia.com)
+;**
+;** This file is part of the (whatever) of the Qt Toolkit.
+;**
+;** $QT_BEGIN_LICENSE:LGPL$
+;** GNU Lesser General Public License Usage
+;** This file may be used under the terms of the GNU Lesser General Public
+;** License version 2.1 as published by the Free Software Foundation and
+;** appearing in the file LICENSE.LGPL included in the packaging of this
+;** file. Please review the following information to ensure the GNU Lesser
+;** General Public License version 2.1 requirements will be met:
+;** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+;**
+;** In addition, as a special exception, Nokia gives you certain additional
+;** rights. These rights are described in the Nokia Qt LGPL Exception
+;** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+;**
+;** GNU General Public License Usage
+;** Alternatively, this file may be used under the terms of the GNU General
+;** Public License version 3.0 as published by the Free Software Foundation
+;** and appearing in the file LICENSE.GPL included in the packaging of this
+;** file. Please review the following information to ensure the GNU General
+;** Public License version 3.0 requirements will be met:
+;** http://www.gnu.org/copyleft/gpl.html.
+;**
+;** Other Usage
+;** Alternatively, this file may be used in accordance with the terms and
+;** conditions contained in a signed written agreement between you and Nokia.
+;**
+;**
+;**
+;**
+;**
+;** $QT_END_LICENSE$
+;**
+;****************************************************************************/
+
+;/* OK, that was the first header, here's another - and this one's wrong */
+
+;/****************************************************************************
+;**
+;** Copyright (C) 2012 Fake Corporation and/or its subsidiary(-ies).
+;** All rights reserved.
+;** Contact: Nokia Corporation (qt-info@nokia.com)
+;**
+;** This file is part of the (whatever) of the Qt Toolkit.
+;**
+;** $QT_BEGIN_LICENSE:LGPL$
+;** GNU Llama Goat Porpoise Lemon Usage
+;** This file may be used under the terms of the GNU Lesser General Public
+;** License version 2.1 as published by the Free Software Foundation and
+;** appearing in the file LICENSE.LGPL included in the packaging of this
+;** file. Please review the following information to ensure the GNU Lesser
+;** General Public License version 2.1 requirements will be met:
+;** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+;**
+;** In addition, as a special exception, Nokia gives you certain additional
+;** rights. These rights are described in the Nokia Qt LGPL Exception
+;** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+;**
+;** GNU General Public License Usage
+;** Alternatively, this file may be used under the terms of the GNU General
+;** Public License version 3.0 as published by the Free Software Foundation
+;** and appearing in the file LICENSE.GPL included in the packaging of this
+;** file. Please review the following information to ensure the GNU General
+;** Public License version 3.0 requirements will be met:
+;** http://www.gnu.org/copyleft/gpl.html.
+;**
+;** Other Usage
+;** Alternatively, this file may be used in accordance with the terms and
+;** conditions contained in a signed written agreement between you and Nokia.
+;**
+;**
+;**
+;**
+;**
+;** $QT_END_LICENSE$
+;**
+;****************************************************************************/
+
+;/* And here's another correct one (to make sure license checker doesn't keep
+; * the status of the last one only)
+; */
+
+;/****************************************************************************
+;**
+;** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+;** All rights reserved.
+;** Contact: Nokia Corporation (qt-info@nokia.com)
+;**
+;** This file is part of the (whatever) of the Qt Toolkit.
+;**
+;** $QT_BEGIN_LICENSE:LGPL$
+;** GNU Lesser General Public License Usage
+;** This file may be used under the terms of the GNU Lesser General Public
+;** License version 2.1 as published by the Free Software Foundation and
+;** appearing in the file LICENSE.LGPL included in the packaging of this
+;** file. Please review the following information to ensure the GNU Lesser
+;** General Public License version 2.1 requirements will be met:
+;** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+;**
+;** In addition, as a special exception, Nokia gives you certain additional
+;** rights. These rights are described in the Nokia Qt LGPL Exception
+;** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+;**
+;** GNU General Public License Usage
+;** Alternatively, this file may be used under the terms of the GNU General
+;** Public License version 3.0 as published by the Free Software Foundation
+;** and appearing in the file LICENSE.GPL included in the packaging of this
+;** file. Please review the following information to ensure the GNU General
+;** Public License version 3.0 requirements will be met:
+;** http://www.gnu.org/copyleft/gpl.html.
+;**
+;** Other Usage
+;** Alternatively, this file may be used in accordance with the terms and
+;** conditions contained in a signed written agreement between you and Nokia.
+;**
+;**
+;**
+;**
+;**
+;** $QT_END_LICENSE$
+;**
+;****************************************************************************/
diff --git a/scripts/t/license-testdata/bad/noheader.cpp b/scripts/t/license-testdata/bad/noheader.cpp
new file mode 100644
index 00000000..5cd1c72a
--- /dev/null
+++ b/scripts/t/license-testdata/bad/noheader.cpp
@@ -0,0 +1 @@
+/* This is a C++ file with no license header - bad! */
diff --git a/scripts/t/license-testdata/bad/wrong-lgpl-nokia.sh b/scripts/t/license-testdata/bad/wrong-lgpl-nokia.sh
new file mode 100644
index 00000000..469db50d
--- /dev/null
+++ b/scripts/t/license-testdata/bad/wrong-lgpl-nokia.sh
@@ -0,0 +1,42 @@
+############################################################################
+##
+## Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+## All rights reserved.
+## Contact: Nokia Corporation (qt-info@nokia.com)
+##
+## This file is part of the (whatever) of the Qt Toolkit.
+##
+## $QT_BEGIN_LICENSE:LGPL$
+## GNU Lesser General Public License Usage
+## This file may be used under the terms of the GNU Lesser General Public
+## License version 2.0 as published by the Free Software Foundation and
+## appearing in the file LICENSE.LGPL included in the packaging of this
+## file. Please review the following information to ensure the GNU Lesser
+## General Public License version 2.0 requirements will be met:
+## http://www.gnu.org/licenses/old-licenses/lgpl-2.0.html.
+##
+## In addition, as a special exception, Nokia gives you certain additional
+## rights. These rights are described in the Nokia Qt LGPL Exception
+## version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+##
+## GNU General Public License Usage
+## Alternatively, this file may be used under the terms of the GNU General
+## Public License version 3.0 as published by the Free Software Foundation
+## and appearing in the file LICENSE.GPL included in the packaging of this
+## file. Please review the following information to ensure the GNU General
+## Public License version 3.0 requirements will be met:
+## http://www.gnu.org/copyleft/gpl.html.
+##
+## Other Usage
+## Alternatively, this file may be used in accordance with the terms and
+## conditions contained in a signed written agreement between you and Nokia.
+##
+##
+##
+##
+##
+## $QT_END_LICENSE$
+##
+############################################################################
+
+# code goes here ...
diff --git a/scripts/t/license-testdata/expected-output.txt b/scripts/t/license-testdata/expected-output.txt
new file mode 100644
index 00000000..cf1897ed
--- /dev/null
+++ b/scripts/t/license-testdata/expected-output.txt
@@ -0,0 +1,56 @@
+#
+# Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# Contact: Nokia Corporation (qt-info@nokia.com)
+#
+# This file is part of the automated tests of the Qt Toolkit.
+#
+# $QT_BEGIN_LICENSE:LGPL$
+# GNU Lesser General Public License Usage
+# This file may be used under the terms of the GNU Lesser General Public
+# License version 2.1 as published by the Free Software Foundation and
+# appearing in the file LICENSE.LGPL included in the packaging of this
+# file. Please review the following information to ensure the GNU Lesser
+# General Public License version 2.1 requirements will be met:
+# http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+#
+# In addition, as a special exception, Nokia gives you certain additional
+# rights. These rights are described in the Nokia Qt LGPL Exception
+# version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+#
+# GNU General Public License Usage
+# Alternatively, this file may be used under the terms of the GNU General
+# Public License version 3.0 as published by the Free Software Foundation
+# and appearing in the file LICENSE.GPL included in the packaging of this
+# file. Please review the following information to ensure the GNU General
+# Public License version 3.0 requirements will be met:
+# http://www.gnu.org/copyleft/gpl.html.
+#
+# Other Usage
+# Alternatively, this file may be used in accordance with the terms and
+# conditions contained in a signed written agreement between you and Nokia.
+#
+#
+#
+#
+#
+# $QT_END_LICENSE$
+#
+# This file contains the expected output of running the license checker
+# on this directory.
+#
+# Any comment or empty lines are ignored for the purposes of comparison.
+# The test numbers are also ignored (as long as the total count of tests
+# is as expected).
+
+1..10
+not ok x - QT_BEGIN_LICENSE does not follow Copyright block in bad/missing-license-info.qdoc, line 9
+not ok x - Mismatch in license text in bad/multiple-header-one-wrong.s
+not ok x - bad/noheader.cpp does not appear to contain a license header
+not ok x - Mismatch in license text in bad/wrong-lgpl-nokia.sh
+ok x - good/multiple-copyright-lgpl.g
+ok x - good/multiple-headers.cpp
+ok x - good/typical-bsd-nokia.cpp
+ok x - good/typical-fdl-nokia.qdoc
+ok x - good/typical-lgpl-nokia.cpp
+ok x - good/typical-lgpl-only-nokia.bat
diff --git a/scripts/t/license-testdata/good/multiple-copyright-lgpl.g b/scripts/t/license-testdata/good/multiple-copyright-lgpl.g
new file mode 100644
index 00000000..0839568f
--- /dev/null
+++ b/scripts/t/license-testdata/good/multiple-copyright-lgpl.g
@@ -0,0 +1,43 @@
+-----------------------------------------------------------------------------
+--
+-- Copyright (C) 2012 Alice
+-- Copyright (C) 2012 Bob
+-- All rights reserved.
+-- Contact: Nokia Corporation (qt-info@nokia.com)
+--
+-- This file is part of the (whatever) of the Qt Toolkit.
+--
+-- $QT_BEGIN_LICENSE:LGPL$
+-- GNU Lesser General Public License Usage
+-- This file may be used under the terms of the GNU Lesser General Public
+-- License version 2.1 as published by the Free Software Foundation and
+-- appearing in the file LICENSE.LGPL included in the packaging of this
+-- file. Please review the following information to ensure the GNU Lesser
+-- General Public License version 2.1 requirements will be met:
+-- http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+--
+-- In addition, as a special exception, Nokia gives you certain additional
+-- rights. These rights are described in the Nokia Qt LGPL Exception
+-- version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+--
+-- GNU General Public License Usage
+-- Alternatively, this file may be used under the terms of the GNU General
+-- Public License version 3.0 as published by the Free Software Foundation
+-- and appearing in the file LICENSE.GPL included in the packaging of this
+-- file. Please review the following information to ensure the GNU General
+-- Public License version 3.0 requirements will be met:
+-- http://www.gnu.org/copyleft/gpl.html.
+--
+-- Other Usage
+-- Alternatively, this file may be used in accordance with the terms and
+-- conditions contained in a signed written agreement between you and Nokia.
+--
+--
+--
+--
+--
+-- $QT_END_LICENSE$
+--
+-----------------------------------------------------------------------------
+
+// code goes here ...
diff --git a/scripts/t/license-testdata/good/multiple-headers.cpp b/scripts/t/license-testdata/good/multiple-headers.cpp
new file mode 100644
index 00000000..ece05e10
--- /dev/null
+++ b/scripts/t/license-testdata/good/multiple-headers.cpp
@@ -0,0 +1,84 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the (whatever) of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// That was the first header.
+// Now there's another (in a different format :)
+
+#if 0
+
+- Copyright (C) 2012 Example Corporation and/or its subsidiary(-ies).
+-
+- All rights reserved.
+- Contact: Nokia Corporation (qt-info@nokia.com)
+-
+- This file is part of the (crazy generated code) of the Qt Toolkit.
+-
+- $QT_BEGIN_LICENSE:BSD$
+- You may use this file under the terms of the BSD license as follows:
+-
+- "Redistribution and use in source and binary forms, with or without
+- modification, are permitted provided that the following conditions are
+- met:
+- * Redistributions of source code must retain the above copyright
+- notice, this list of conditions and the following disclaimer.
+- * Redistributions in binary form must reproduce the above copyright
+- notice, this list of conditions and the following disclaimer in
+- the documentation and/or other materials provided with the
+- distribution.
+- * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+- the names of its contributors may be used to endorse or promote
+- products derived from this software without specific prior written
+- permission.
+-
+- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+- OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+- $QT_END_LICENSE$
+-
+#endif
diff --git a/scripts/t/license-testdata/good/typical-bsd-nokia.cpp b/scripts/t/license-testdata/good/typical-bsd-nokia.cpp
new file mode 100644
index 00000000..f7723e8d
--- /dev/null
+++ b/scripts/t/license-testdata/good/typical-bsd-nokia.cpp
@@ -0,0 +1,41 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the (whatever) of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// code goes here ...
diff --git a/scripts/t/license-testdata/good/typical-fdl-nokia.qdoc b/scripts/t/license-testdata/good/typical-fdl-nokia.qdoc
new file mode 100644
index 00000000..892e8424
--- /dev/null
+++ b/scripts/t/license-testdata/good/typical-fdl-nokia.qdoc
@@ -0,0 +1,28 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the (whatever) of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** GNU Free Documentation License
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms
+** and conditions contained in a signed written agreement between you
+** and Nokia.
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// code goes here ...
diff --git a/scripts/t/license-testdata/good/typical-lgpl-nokia.cpp b/scripts/t/license-testdata/good/typical-lgpl-nokia.cpp
new file mode 100644
index 00000000..ac4320b8
--- /dev/null
+++ b/scripts/t/license-testdata/good/typical-lgpl-nokia.cpp
@@ -0,0 +1,42 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the (whatever) of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// code goes here ...
diff --git a/scripts/t/license-testdata/good/typical-lgpl-only-nokia.bat b/scripts/t/license-testdata/good/typical-lgpl-only-nokia.bat
new file mode 100644
index 00000000..254698a0
--- /dev/null
+++ b/scripts/t/license-testdata/good/typical-lgpl-only-nokia.bat
@@ -0,0 +1,24 @@
+::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+::
+:: Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+:: All rights reserved.
+:: Contact: Nokia Corporation (qt-info@nokia.com)
+::
+:: This file is part of the (whatever) of the Qt Toolkit.
+::
+:: $QT_BEGIN_LICENSE:LGPL-ONLY$
+:: GNU Lesser General Public License Usage
+:: This file may be used under the terms of the GNU Lesser
+:: General Public License version 2.1 as published by the Free Software
+:: Foundation and appearing in the file LICENSE.LGPL included in the
+:: packaging of this file. Please review the following information to
+:: ensure the GNU Lesser General Public License version 2.1 requirements
+:: will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+::
+:: If you have questions regarding the use of this file, please contact
+:: Nokia at qt-info@nokia.com.
+:: $QT_END_LICENSE$
+::
+::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
+rem code goes here
diff --git a/scripts/t/license-testdata/reference/header.BSD b/scripts/t/license-testdata/reference/header.BSD
new file mode 100644
index 00000000..6955c9ec
--- /dev/null
+++ b/scripts/t/license-testdata/reference/header.BSD
@@ -0,0 +1,40 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the FOO module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
diff --git a/scripts/t/license-testdata/reference/header.FDL b/scripts/t/license-testdata/reference/header.FDL
new file mode 100644
index 00000000..238e22df
--- /dev/null
+++ b/scripts/t/license-testdata/reference/header.FDL
@@ -0,0 +1,27 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** GNU Free Documentation License
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms
+** and conditions contained in a signed written agreement between you
+** and Nokia.
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
diff --git a/scripts/t/license-testdata/reference/header.LGPL b/scripts/t/license-testdata/reference/header.LGPL
new file mode 100644
index 00000000..971b9a98
--- /dev/null
+++ b/scripts/t/license-testdata/reference/header.LGPL
@@ -0,0 +1,41 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the FOO module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
diff --git a/scripts/t/license-testdata/reference/header.LGPL-ONLY b/scripts/t/license-testdata/reference/header.LGPL-ONLY
new file mode 100644
index 00000000..ef11ac96
--- /dev/null
+++ b/scripts/t/license-testdata/reference/header.LGPL-ONLY
@@ -0,0 +1,22 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the FOO module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL-ONLY$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/