summaryrefslogtreecommitdiffstats
path: root/scripts/300_autotests
blob: cacd4f874818d9304bbb9b49cf727d3655c7ec87 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
#--------------------------------------------------------------------------------------------------
# Standard modularization template
# --------------------------------
#
# The script will start execution from <QTDIR>.
#
# Available variables:
#     $qtdir    = <QTDIR> or where you started the modularize script from
#     $basepath = path for the modularize script, and basepath for the modularization repo
#     $OStype   = <n> where <n> is one of 0 = Windows, 1 = Unix, 2 = Mac
#
# To execute a command:
#     run("git mv foo bar")        # runs command, reports error possition and dies
#     runNotDie("git mv foo bar")  # runs command, reports error possition, returns error code
#                                    and continues. Use ($? >> 8) to get the real exit code.
#     ensureDir("qtkernel")        # Ensures that qtkernel exists and is a directory. Will create
#                                    it if it does not exist.
#--------------------------------------------------------------------------------------------------

require("non-module-helpers");

use File::Basename;

my $debugScript = 0;

# Move the data files of bic from global to modules
our @bicRepos =  ('qtkernel' , 'qtsvg', 'qtquick', 'qt3support', 'qtscript', 'phonon', 'qtmultimedia', 'qttools', 'qtxmlpatterns');
foreach (@bicRepos) {
    my $module = $_;
    ensureDir("$module/tests/auto/bic/data");
    fsCopy("$basepath/files/tests/auto/bic/.gitignore", "$module/tests/auto/bic/");
    run("git add $module/tests/auto/bic/.gitignore");
    ensureDir("$module/tests/global");
    fsCopy("$basepath/files/tests/global/.gitignore", "$module/tests/global/");
    run("git add $module/tests/global/.gitignore");
}

run("git mv tests/auto/bic/data/QtXmlPatterns* qtxmlpatterns/tests/auto/bic/data");

run("git mv tests/auto/bic/data/QtCore* qtkernel/tests/auto/bic/data");
run("git mv tests/auto/bic/data/QtGui* qtkernel/tests/auto/bic/data");
run("git mv tests/auto/bic/data/QtOpenGL* qtkernel/tests/auto/bic/data");
run("git mv tests/auto/bic/data/QtNetwork* qtkernel/tests/auto/bic/data");
run("git mv tests/auto/bic/data/QtSql* qtkernel/tests/auto/bic/data");
run("git mv tests/auto/bic/data/QtXml* qtkernel/tests/auto/bic/data");
run("git mv tests/auto/bic/data/QtTest* qtkernel/tests/auto/bic/data");
run("git mv tests/auto/bic/data/QtDBus* qtkernel/tests/auto/bic/data");

run("git mv tests/auto/bic/data/QtSvg* qtsvg/tests/auto/bic/data");

run("git mv tests/auto/bic/data/QtDeclarative* qtquick/tests/auto/bic/data");

run("git mv tests/auto/bic/data/Qt3Support* qt3support/tests/auto/bic/data");

run("git mv tests/auto/bic/data/QtScriptTools* qtscript/tests/auto/bic/data");
run("git mv tests/auto/bic/data/QtScript* qtscript/tests/auto/bic/data");

run("git mv tests/auto/bic/data/phonon* phonon/tests/auto/bic/data");

run("git mv tests/auto/bic/data/QtMultimedia* qtmultimedia/tests/auto/bic/data");

run("git mv tests/auto/bic/data/QtDesigner* qttools/tests/auto/bic/data");
run("git mv tests/auto/bic/data/QtHelp* qttools/tests/auto/bic/data");

# Todo: tests/auto/bic/data/QtWebKit*

# global tests
our @globalTests =  ('bic' , 'headers', 'compilerwarnings', 'symbols', 'guiapplauncher');
ensureDir("qtqa/tests/auto");
foreach my $test (@globalTests) {
    run("git mv tests/auto/$test qtqa/tests/auto/");
}

ensureDir("qttools/tests/auto");
run("git mv tests/auto/linguist qttools/tests/auto");

sub processProfile {
    my $profile = $_[0];
    $profile = "tests/auto/$profile";
    my $module = $_[1];

    ensureDir("$module/tests/auto") if ($module);
    my @stat = stat($profile);
    open($readFd, "< $profile") or die("Could not open $profile");
    open($writeFd, "> $profile.tmp") or die("Could not open $profile.tmp");

    while (<$readFd>) {
        $skip = 0;
        if (/([\.a-z0-9_]+)/) {
            $candidate = $1;

            if (-d "tests/auto/$candidate") {
                if (!$module) {
                    run ("git rm -rfq tests/auto/$candidate");
                } else {
                    run ("git mv tests/auto/$candidate $module/tests/auto/");
                }
            } else {
                foreach my $test (@globalTests) {
                    if($candidate eq $test) {
                        $skip = 1;
                    }
                }
            }
        }
        if ($skip == 0) {
            print($writeFd $_);
        }
    }

    close($readFd);
    close($writeFd);
    unlink($profile);
    rename("$profile.tmp", $profile) or die("Could not rename $profile.tmp -> $profile");

    if (!$module) {
        run("git rm -fq $profile");
    } else {
        run("git mv $profile $module/tests/auto/");
    }
}


#process each .pro file
processProfile("corelib.pro", "qtkernel");
processProfile("gui.pro", "qtkernel");
processProfile("network.pro", "qtkernel");
processProfile("sql.pro", "qtkernel");
processProfile("xml.pro", "qtkernel");
processProfile("other.pro", "qtkernel");
processProfile("host.pro", "qtkernel");
processProfile("opengl.pro", "qtkernel");
processProfile("dbus.pro", "qtkernel");
processProfile("qt3support.pro", "qt3support");
processProfile("xmlpatterns.pro", "qtxmlpatterns");
processProfile("script.pro", "qtscript");
processProfile("phonon.pro", "phonon");
processProfile("svg.pro", "qtsvg");
processProfile("multimedia.pro", "qtmultimedia");
processProfile("webkit.pro", "");
processProfile("help.pro", "qttools");

ensureDir("qtquick/tests/auto");
run("git mv tests/auto/declarative qtquick/tests/auto/");
run("git mv tests/auto/declarative.pro qtquick/tests/auto/auto.pro");

#they are in other.pro, but on the same line
run("git mv tests/auto/qzip qtkernel/tests/auto/");
run("git mv tests/auto/qtextodfwriter qtkernel/tests/auto/");
run("git mv tests/auto/uic3 qt3support/tests/auto/");


#  benchmarks
ensureDir("qtquick/tests/benchmarks");
ensureDir("qtsvg/tests/benchmarks");
ensureDir("qtscript/tests/benchmarks");
run("git mv tests/benchmarks/declarative qtquick/tests/benchmarks");
run("git mv tests/benchmarks/svg qtsvg/tests/benchmarks");
run("git mv tests/benchmarks/script qtscript/tests/benchmarks");
run("git mv tests/benchmarks qtkernel/tests/");


#shared
run("git mv tests/shared qtkernel/tests");
run("git mv tests/auto/*.h qtkernel/tests/auto");

ensureDir("qtquick/tests/shared");
fsCopy("qtkernel/tests/shared/util.h", "qtquick/tests/shared/");
ensureDir("qt3support/tests/shared");
fsCopy("qtkernel/tests/shared/util.h", "qt3support/tests/shared/");
ensureDir("qtscript/tests/shared");
fsCopy("qtkernel/tests/shared/util.h", "qtscript/tests/shared/");
run("git add qtquick/tests/shared/util.h qt3support/tests/shared/util.h qtscript/tests/shared/util.h");


fsCopy("qtkernel/tests/auto/network-settings.h", "qt3support/tests/auto/");
fsCopy("qtkernel/tests/auto/network-settings.h", "qtxmlpatterns/tests/auto/");
run("git add qt3support/tests/auto/network-settings.h  qtxmlpatterns/tests/auto/network-settings.h");

# There is patch corresponding to this which changes the include path
fsCopy("qt3support/src/qt3support/tools/q3tl.h", "qtkernel/tests/auto/qalgorithms/");
run("git add qtkernel/tests/auto/qalgorithms/q3tl.h");


#residues
run("git mv tests/auto/xmlpatterns.pri qtxmlpatterns/tests/auto/");
run("git mv tests/auto/solutions.pri qtkernel/tests/auto/");
run("git mv tests/auto/qtextbrowser.html qtkernel/tests/auto/");
run("git mv tests/auto/test.pl qtkernel/tests/auto/");  #i don't know if it belongs there.
run("git mv tests/auto/qsslsocket_onDemandCertificates_member qtkernel/tests/auto/");
run("git mv tests/auto/qsslsocket_onDemandCertificates_static qtkernel/tests/auto/");

run("git mv tests/arthur qtkernel/tests/");

#profiles
run("git mv tests/auto/auto.pro qtkernel/tests/auto/");
run("git mv qtmultimedia/tests/auto/multimedia.pro qtmultimedia/tests/auto/auto.pro");
run("git mv qtscript/tests/auto/script.pro qtscript/tests/auto/auto.pro");
run("git mv qtsvg/tests/auto/svg.pro qtsvg/tests/auto/auto.pro");
run("git mv qtxmlpatterns/tests/auto/xmlpatterns.pro qtxmlpatterns/tests/auto/auto.pro");
run("git mv qt3support/tests/auto/qt3support.pro qt3support/tests/auto/auto.pro");
run("git mv qttools/tests/auto/help.pro qttools/tests/auto/auto.pro");
run("echo !cross_compile:SUBDIRS += uic3 >> qt3support/tests/auto/auto.pro");
run("echo SUBDIRS += linguist >> qttools/tests/auto/auto.pro");

run("git mv tests/tests.pro qtkernel/tests/");
createSubdirProfile("qtquick/tests");
createSubdirProfile("qt3support/tests");
createSubdirProfile("qtsvg/tests");
createSubdirProfile("qtscript/tests");
createSubdirProfile("qtmultimedia/tests");
createSubdirProfile("qtxmlpatterns/tests");
createSubdirProfile("qttools/tests");

createSubdirProfile("qtqa/tests/auto");
createSubdirProfile("qtqa/tests");
createSubdirProfile("qtqa");

# Move manual tests, they all depend only on qtkernel
run("git mv tests/manual qtkernel/tests/manual/");

# Add the test directory's README to every module with a test directory
foreach (@repos) {
    my $module = $_;
    if (-d "$module/tests") {
        fsCopy("tests/README", "$module/tests/");
        run("git add $module/tests/README");
    }
}

# clean up, for completeness (will fail on remaining files)
run("git rm tests/README");
fsRmdir("tests/auto/");
fsRmdir("tests/");

return 1;