Skip to content

Commit c0314bf

Browse files
committed
Try to split out tests and test dependencies into separate projects
1 parent 3dc9742 commit c0314bf

File tree

10 files changed

+45
-59
lines changed

10 files changed

+45
-59
lines changed

dub.sdl

Lines changed: 4 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,12 @@
11
name "mysql-native"
22
description "A native MySQL driver implementation based on Steve Teale's original"
33
license "BSL-1.0"
4-
copyright "Copyright (c) 2011-2019 Steve Teale, James W. Oliphant, Simen Endsjø, Sönke Ludwig, Sergey Shamov, and Nick Sabalausky"
5-
authors "Steve Teale" "James W. Oliphant" "Simen Endsjø" "Sönke Ludwig" "Sergey Shamov" "Nick Sabalausky"
4+
copyright "Copyright (c) 2011-2021 Steve Teale, James W. Oliphant, Simen Endsjø, Sönke Ludwig, Sergey Shamov, Nick Sabalausky, and Steven Schveighoffer"
5+
authors "Steve Teale" "James W. Oliphant" "Simen Endsjø" "Sönke Ludwig" "Sergey Shamov" "Nick Sabalausky" "Steven Schveighoffer"
66

77
dependency "vibe-core" version="~>1.16.0" optional=true
88

99
toolchainRequirements frontend=">=2.068"
1010

11-
sourcePaths "source/"
12-
importPaths "source/"
13-
14-
configuration "application" {
15-
targetType "executable"
16-
versions "VibeCustomMain"
17-
}
18-
19-
configuration "library" {
20-
targetType "library"
21-
excludedSourceFiles "source/app.d"
22-
}
23-
24-
// Do not use this. Use "run_tests" insetad.
25-
configuration "unittest" {
26-
excludedSourceFiles "source/app.d"
27-
preBuildCommands \
28-
"echo \"ERROR: Don't use 'dub test' to test mysql-native. Use 'run_tests' instead.\"" \
29-
"echo Bailing..." \
30-
"mkdir" // Generate error to halt build
31-
}
32-
33-
// Run with: dub test -c unittest-vibe
34-
configuration "unittest-vibe" {
35-
targetType "executable"
36-
targetPath "bin/"
37-
targetName "mysqln-tests-vibe"
38-
excludedSourceFiles "source/app.d"
39-
40-
dependency "vibe-core" version="~>1.16.0" optional=false
41-
42-
// mainSourceFile "source/mysql/package.d"
43-
debugVersions "MYSQLN_TESTS"
44-
}
45-
46-
// Run with: dub run -c unittest-vibe-ut -- -t
47-
configuration "unittest-vibe-ut" {
48-
targetType "executable"
49-
targetPath "bin/"
50-
targetName "mysqln-tests-vibe"
51-
excludedSourceFiles "source/app.d"
52-
sourceFiles "bin/ut.d"
53-
importPaths "bin/"
54-
buildOptions "unittests"
55-
56-
dependency "vibe-core" version="~>1.16.0" optional=false
57-
58-
dependency "unit-threaded" version="~>1.0.15"
59-
60-
debugVersions "MYSQLN_TESTS"
61-
versions "MYSQLN_TESTS_NO_MAIN"
62-
versions "unitUnthreaded"
63-
64-
preBuildCommands "dub run unit-threaded -c gen_ut_main -- -f bin/ut.d"
65-
}
11+
subPackage "./integration-tests"
12+
subPackage "./testconn"

integration-tests/dub.sdl

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name "integration-tests"
2+
description "Test harness for integration tests"
3+
license "BSL-1.0"
4+
copyright "Copyright (c) 2011-2021 Steve Teale, James W. Oliphant, Simen Endsjø, Sönke Ludwig, Sergey Shamov, and Nick Sabalausky"
5+
authors "Steve Teale" "James W. Oliphant" "Simen Endsjø" "Sönke Ludwig" "Sergey Shamov" "Nick Sabalausky" "Steven Schveighoffer"
6+
7+
dependency "mysql-native" path="../"
8+
dependency "unit-threaded" version="~>0.7.45"
9+
dependency "vibe-core" version="~>1.0"
10+
11+
configuration "unittest" {
12+
targetType "executable"
13+
debugVersions "MYSQLN_TESTS"
14+
versions "MYSQLN_TESTS_NO_MAIN"
15+
versions "unitUnthreaded"
16+
sourceFiles "bin/ut.d"
17+
importPaths "bin/"
18+
buildOptions "unittests"
19+
20+
preBuildCommands "dub run unit-threaded -c gen_ut_main -- -f bin/ut.d"
21+
}

integration-tests/source/app.d

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import mysql.test.common;
2+
import mysql.test.integration;
3+
import mysql.test.regression;

source/mysql/test/common.d renamed to integration-tests/source/mysql/test/common.d

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,18 @@ version(DoCoreTests)
4242
private @property string testConnectionStrFile()
4343
{
4444
import std.file, std.path;
45+
46+
return "testConnectionStr.txt";
4547

46-
static string cached;
48+
/*static string cached;
4749
if(!cached)
50+
{
51+
import std.stdio;
4852
cached = buildPath(thisExePath.dirName.dirName, "testConnectionStr.txt");
53+
writeln("the file is ", cached);
54+
}
4955
50-
return cached;
56+
return cached;*/
5157
}
5258

5359
@property string testConnectionStr()
@@ -84,6 +90,8 @@ version(DoCoreTests)
8490

8591
Connection createCn(string cnStr = testConnectionStr)
8692
{
93+
import std.stdio;
94+
writeln("testing with connection string ", testConnectionStr);
8795
return new Connection(cnStr);
8896
}
8997

testconn/.dub.sdl.swp

12 KB
Binary file not shown.

testconn/dub.sdl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
name "test"
2+
description "Test harness for integration tests"
3+
license "BSL-1.0"
4+
copyright "Copyright (c) 2011-2021 Steve Teale, James W. Oliphant, Simen Endsjø, Sönke Ludwig, Sergey Shamov, and Nick Sabalausky"
5+
authors "Steve Teale" "James W. Oliphant" "Simen Endsjø" "Sönke Ludwig" "Sergey Shamov" "Nick Sabalausky" "Steven Schveighoffer"
6+
7+
dependency "mysql-native" version="*"

testconn/source/.app.d.swp

12 KB
Binary file not shown.
File renamed without changes.

0 commit comments

Comments
 (0)