Skip to content

Commit

Permalink
Add the Phobos v3 unit tests to the regular unittest build.
Browse files Browse the repository at this point in the history
I'm sure that we'll need to rework the build stuff at some point here
(both for Phobos v2 and v3), but this gets the v3 tests run by the v2
Makefile so that the CI will build and run them.
  • Loading branch information
jmdavis committed Oct 26, 2024
1 parent 2852e84 commit 4d31471
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,7 @@ else
unittest : unittest-debug unittest-release
unittest-%:
$(MAKE) unittest OS=$(OS) MODEL=$(MODEL) DMD=$(DMD) BUILD=$*
dmd -run build_v3.d unittest-$*
endif

################################################################################
Expand Down
25 changes: 17 additions & 8 deletions build_v3.d
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,16 @@ int main(string[] args)
bool buildRelease = false;
if (args.length > 1)
{
buildUnittest = args[1] == "unittest";
buildRelease = args[1] == "release";
switch(args[1])
{
// FIXME unittest should build both debug and release, but that
// requires more extensive changes.
case "unittest": buildUnittest = true; break;
case "unittest-debug": buildUnittest = true; break;
case "unittest-release": buildUnittest = true; goto case "release";
case "release": buildRelease = true; break;
default: break;
}
}

string argFilePath = buildNormalizedPath(getcwd(), "phobosbuildargs.txt");
Expand Down Expand Up @@ -69,7 +77,6 @@ int main(string[] args)
{
argFile.writeln("-main");
argFile.writeln("-unittest");
argFile.writeln("-debug");

version(Windows)
{
Expand All @@ -80,17 +87,19 @@ int main(string[] args)
argFile.writeln("-of=unittest");
}
}
else if (buildRelease)
else
{
argFile.writeln("-release -O");
argFile.writeln("-lib");
argFile.writeln("-of=libphobos3");
argFile.writefln("-of=libphobos3%s", buildRelease ? "" : "-debug");
}

if (buildRelease)
{
argFile.writeln("-release -O");
}
else
{
argFile.writeln("-debug");
argFile.writeln("-lib");
argFile.writeln("-of=libphobos3-debug");
}

argFile.flush();
Expand Down

0 comments on commit 4d31471

Please sign in to comment.