From fc24574598276a65fc2c1336895656ffd6e12c02 Mon Sep 17 00:00:00 2001 From: Keith Pinson Date: Wed, 15 Jun 2016 12:56:58 -0400 Subject: [PATCH] Add initial support for Fuchu tests Something like this has been discussed at #234, and there is an open issue for this more specifically at #742. And while there seem to be some questions of how to do this in the best way, or polish it, I am of the opinion that it is better to have something than nothing. It is rather reassuring to n00bs particularly when they see that tools are at least aware of each other, and this is one of the big draws of FAKE. The code is derived from the example from Fuchu itself: https://github.com/mausch/Fuchu/blob/5ef9ec303abf56f8ca5511cda3fb53bfa705007c/build.fsx#L119 --- src/app/FakeLib/FakeLib.fsproj | 3 ++- src/app/FakeLib/FuchuHelper.fs | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 src/app/FakeLib/FuchuHelper.fs diff --git a/src/app/FakeLib/FakeLib.fsproj b/src/app/FakeLib/FakeLib.fsproj index 0ae139d2280..6d80d825bbe 100644 --- a/src/app/FakeLib/FakeLib.fsproj +++ b/src/app/FakeLib/FakeLib.fsproj @@ -1,4 +1,4 @@ - + @@ -71,6 +71,7 @@ + diff --git a/src/app/FakeLib/FuchuHelper.fs b/src/app/FakeLib/FuchuHelper.fs new file mode 100644 index 00000000000..06a4bdf45ef --- /dev/null +++ b/src/app/FakeLib/FuchuHelper.fs @@ -0,0 +1,19 @@ +module Fake.FuchuHelper + +/// Execute Fuchu tests from one or more assemblies. +/// Multiple assemblies are run concurrently. +/// ## Parameters +/// +/// - `testExes` - The paths of the executables containing Fuchu tests to run. +let Fuchu testExes = + let errorCode = + testExes + |> Seq.map (fun program -> if not isMono + then program, null + else "mono", program) + |> Seq.map (fun (program, args) -> asyncShellExec { defaultParams with Program = program; CommandLine = args }) + |> Async.Parallel + |> Async.RunSynchronously + |> Array.sum + if errorCode <> 0 + then failwith "Unit tests failed"