From ba2905dd1dbd0a82728c7db167bb11379a4cedc0 Mon Sep 17 00:00:00 2001 From: Kazuki Sakamoto Date: Mon, 7 Nov 2016 19:31:29 -0800 Subject: [PATCH] Add C# test script for macOS Summary: - Updated README and added bash script for testing C# on macOS Reviewed By: emilsjolander Differential Revision: D4142507 fbshipit-source-id: c682778e42d10242e02f3fdafe8a23f906bfabc5 --- README.md | 3 ++ csharp/tests/Facebook.CSSLayout/test_macos.sh | 32 +++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100755 csharp/tests/Facebook.CSSLayout/test_macos.sh diff --git a/README.md b/README.md index 37479cfe..fb1f8b45 100644 --- a/README.md +++ b/README.md @@ -152,5 +152,8 @@ Run `gentest/gentest.rb` to generate test code and re-run `buck test //:CSSLayou You may need to install the latest watir-webdriver gem (`gem install watir-webdriver`) and [ChromeDriver](https://sites.google.com/a/chromium.org/chromedriver/) to run `gentest/gentest.rb` Ruby script. +#### .NET +.NET testing is not integrated in buck yet, you might need to set up .NET testing environment. We have a script which to launch C# test on macOS, `csharp/tests/Facebook.CSSLayout/test_macos.sh`. + ### Benchmarks Benchmarks are located in `benchmarks/CSSBenchmark.c` and can be run with `buck run //benchmarks:benchmarks`. If you think your change has affected performance please run this before and after your change to validate that nothing has regressed. diff --git a/csharp/tests/Facebook.CSSLayout/test_macos.sh b/csharp/tests/Facebook.CSSLayout/test_macos.sh new file mode 100755 index 00000000..27e39f64 --- /dev/null +++ b/csharp/tests/Facebook.CSSLayout/test_macos.sh @@ -0,0 +1,32 @@ +#!/bin/sh +if clang --version >/dev/null 2>&1; then true; else + echo "ERROR: Can't execute clang. You need to install Xcode and command line tools." + exit 1 +fi + +if mcs --version >/dev/null 2>&1; then true; else + echo "ERROR: Can't execute mcs. You need to install Mono from http://www.mono-project.com/download/ and re-login to apply PATH environment." + exit 1 +fi + +if mono64 --version >/dev/null 2>&1; then true; else + echo "ERROR: Can't execute mono64. You need to install Mono from http://www.mono-project.com/download/ and re-login to apply PATH environment." + exit 1 +fi + +NUNIT=NUnit-2.6.4/bin +if [ -d $NUNIT \ + -a -f $NUNIT/nunit-console.exe \ + -a -f $NUNIT/lib/nunit-console-runner.dll \ + -a -f $NUNIT/lib/nunit.core.dll \ + -a -f $NUNIT/lib/nunit.core.interfaces.dll \ + -a -f $NUNIT/lib/nunit.util.dll ]; then true; else + curl -L -O https://github.com/nunit/nunitv2/releases/download/2.6.4/NUnit-2.6.4.zip + unzip NUnit-2.6.4.zip + rm NUnit-2.6.4.zip +fi + +cd "$( dirname "$0" )" +clang -g -DCSS_ASSERT_FAIL_ENABLED -Wall -Wextra -dynamiclib -o libCSSLayout.dylib -I../../.. ../../../CSSLayout/*.c ../../CSSLayout/CSSInterop.cpp +mcs -debug -t:library -r:$NUNIT/nunit.framework.dll -out:CSSLayoutTest.dll *.cs ../../../csharp/Facebook.CSSLayout/*cs +MONO_PATH=$NUNIT mono64 --debug $NUNIT/nunit-console.exe CSSLayoutTest.dll