Skip to content

Commit fbd9921

Browse files
committed
run_tests: Added --mode=travis which supports new NO_VIBE envar and fixes broken USE_UNIT_THREADED envar.
1 parent 974f101 commit fbd9921

File tree

3 files changed

+52
-7
lines changed

3 files changed

+52
-7
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ addons:
135135
packages: [ libevent-dev ]
136136

137137
install: $DMD -ofci_setup ci_setup.d && ./ci_setup
138-
script: ./run_tests --mode=combined
138+
script: ./run_tests --mode=travis
139139

140140
matrix:
141141
include:

CHANGELOG.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
v3.0.0 - TBD
2+
=====================
3+
4+
Update from `vibe-d:core` to `vibe-core`, and various CI improvements.
5+
6+
- **Change:** Switched from outdated `vibe-d:core` to modern `vibe-core`.
7+
- **Fixed:** [#199](https://github.com/mysql-d/mysql-native/issues/199):
8+
It is immposible to use this package anymore without libevent.
9+
- **Fixed:** [#201](https://github.com/mysql-d/mysql-native/issues/201):
10+
Always selects `vibe-d:core`, cannot select `vibe-core`.
11+
- **Tests:** Add NO_VIBE option for travis-ci (DMDFE 2.075.x and below don't work with vibe-core).
12+
- **Tests:** [#197](https://github.com/mysql-d/mysql-native/issues/197):
13+
Travis-ci build issues on various compiler versions.
14+
- **Tests:** Fixed:
15+
116
v2.3.0 - 2019-02-23
217
=====================
318

run_tests.d

Lines changed: 36 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import std.string;
99
// Commandline args
1010
bool useUnitThreaded;
1111
bool coreTestsOnly;
12-
enum Mode { phobos, vibe, combined };
12+
enum Mode { phobos, vibe, combined, travis };
1313
Mode mode;
1414
string[] unitThreadedArgs;
1515

@@ -18,23 +18,24 @@ int exitCode=0;
1818

1919
// Utils ///////////////////////////////////////////////
2020

21-
string flagUseUnitThreaded(bool on)
21+
pure string flagUseUnitThreaded(bool on)
2222
{
2323
return on? " --ut" : "";
2424
}
2525

26-
string flagCoreTestsOnly(bool on)
26+
pure string flagCoreTestsOnly(bool on)
2727
{
2828
return on? " --core" : "";
2929
}
3030

31-
string flagMode(Mode mode)
31+
pure string flagMode(Mode mode)
3232
{
3333
final switch(mode)
3434
{
3535
case Mode.phobos: return " --mode=phobos";
3636
case Mode.vibe: return " --mode=vibe";
3737
case Mode.combined: return " --mode=combined";
38+
case Mode.travis: return " --mode=travis";
3839
}
3940
}
4041

@@ -108,7 +109,7 @@ int main(string[] args)
108109
"ut", "Use unit-threaded (Always includes ut's --trace)", &useUnitThreaded,
109110
"core", "Only run basic core tests (Can only be used with --mode=phobos)", &coreTestsOnly,
110111
std.getopt.config.required,
111-
"m|mode", "'-m=phobos': Run Phobos tests | '-m=vibe': Run Vibe.d tests | '-m=combined': Run core-only Phobos tests and all Vibe.d tests", &mode,
112+
"m|mode", "'-m=phobos': Run Phobos tests | '-m=vibe': Run Vibe.d tests | '-m=combined': Run core-only Phobos tests and all Vibe.d tests | '-m=travis': Travis-CI mode (autodetect settings from envvars)", &mode,
112113
);
113114

114115
if(argsHelp.helpWanted)
@@ -117,7 +118,7 @@ int main(string[] args)
117118
"Runs the mysql-native test suite with Phobos sockets, Vibe.d sockets, or combined.\n"~
118119
"\n"~
119120
"Usage:\n"~
120-
" run_tests --mode=(phobos|vibe|combined) [OPTIONS] [-- [UNIT-THREADED OPTIONS]]\n"~
121+
" run_tests --mode=(phobos|vibe|combined|travis) [OPTIONS] [-- [UNIT-THREADED OPTIONS]]\n"~
121122
"\n"~
122123
"Examples:\n"~
123124
" run_tests --mode=combined\n"~
@@ -155,6 +156,13 @@ int main(string[] args)
155156
return 1;
156157
}
157158

159+
if(mode==Mode.travis && (coreTestsOnly || useUnitThreaded))
160+
{
161+
stderr.writeln("Cannot use --mode=travis together with any other option.");
162+
stderr.writeln("For help: run_tests --help");
163+
return 1;
164+
}
165+
158166
unitThreadedArgs = args[1..$];
159167
runTests();
160168
return exitCode;
@@ -174,6 +182,7 @@ void runTests()
174182
case Mode.phobos: runPhobosTests(); break;
175183
case Mode.vibe: runVibeTests(); break;
176184
case Mode.combined: runCombinedTests(); break;
185+
case Mode.travis: runTravisTests(); break;
177186
}
178187
}
179188

@@ -270,3 +279,24 @@ void runCombinedTests()
270279
);
271280
exitCode = vibeStatus;
272281
}
282+
283+
void runTravisTests()
284+
{
285+
useUnitThreaded = environment["USE_UNIT_THREADED"] == "true";
286+
auto noVibe = environment["NO_VIBE"] == "true";
287+
288+
if(noVibe)
289+
{
290+
auto phobosStatus = runFromCurrentDir(
291+
"run_tests"~
292+
flagMode(Mode.phobos)~
293+
flagCoreTestsOnly(false)~
294+
flagUseUnitThreaded(useUnitThreaded)
295+
);
296+
exitCode = phobosStatus;
297+
}
298+
else
299+
{
300+
runCombinedTests();
301+
}
302+
}

0 commit comments

Comments
 (0)