diff --git a/debian/tests/TestProject/Main.cs b/debian/tests/TestProject/Main.cs new file mode 100644 index 0000000000..9bd1c60f76 --- /dev/null +++ b/debian/tests/TestProject/Main.cs @@ -0,0 +1,30 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Google.Apis; + +namespace TestProject +{ + class Program + { + static void Main(string[] args) + { + Stack myStack = new Stack(); + var th = new Thread(()=>WaitAndPrint(myStack)); + th.Start(); + Console.WriteLine("Me first!"); + myStack.Push(1); + Console.WriteLine("Finished tasks: {0}", myStack.Count); + Thread.Sleep(1000); + Console.WriteLine("Finished tasks: {0}", myStack.Count); + } + + private static void WaitAndPrint(Stack myStack){ + Thread.Sleep(1000); + Console.WriteLine("Me second!"); + myStack.Push(2); + } + } +} diff --git a/debian/tests/TestProject/TestProject.csproj b/debian/tests/TestProject/TestProject.csproj new file mode 100644 index 0000000000..74abf5c976 --- /dev/null +++ b/debian/tests/TestProject/TestProject.csproj @@ -0,0 +1,10 @@ + + + + Exe + net6.0 + enable + enable + + + diff --git a/debian/tests/basic-checks b/debian/tests/basic-checks index b6bfe23f48..a02dbc6718 100644 --- a/debian/tests/basic-checks +++ b/debian/tests/basic-checks @@ -12,4 +12,5 @@ BINARY="/usr/bin/dotnet" echo "Checking binary is present and its usefulness" test -e "${BINARY}" dotnet --version -dotnet --info \ No newline at end of file +dotnet --info +dotnet sdk check diff --git a/debian/tests/basic-commands b/debian/tests/basic-commands index 4ddc02a59e..fd0cb3af9b 100644 --- a/debian/tests/basic-commands +++ b/debian/tests/basic-commands @@ -8,4 +8,13 @@ set -eo pipefail dotnet new console --name TestConsole cd TestConsole -dotnet run | grep -qF "Hello, World!" \ No newline at end of file +dotnet new sln +dotnet sln TestConsole.sln add TestConsole.csproj +dotnet build TestConsole.sln +cd bin/Debug/net6.0/ +output=$(./TestConsole) +if [ "$output" != "Hello, World!" ]; then + echo 'Test did not output "Hello, World!"' + exit 1 +fi +cd .. diff --git a/debian/tests/control b/debian/tests/control index e1a6b6701f..8689f9b79f 100644 --- a/debian/tests/control +++ b/debian/tests/control @@ -1,3 +1,7 @@ Tests: basic-checks basic-commands Depends: @ Restrictions: superficial + +Tests: csproj-with-nuget +Depends: @ +Restrictions: superficial isolation-container needs-internet diff --git a/debian/tests/csproj-with-nuget b/debian/tests/csproj-with-nuget new file mode 100644 index 0000000000..40a3ca172a --- /dev/null +++ b/debian/tests/csproj-with-nuget @@ -0,0 +1,17 @@ +#!/bin/bash + +################################## +### Check basic nuget commands ### +################################## + +set -eo pipefail + +cd "$(dirname "${0}")"/TestProject +dotnet add TestProject.csproj package Google.Apis +output=$(dotnet run | wc -l) +if [ "$output" != "4" ]; then + echo 'Test project did not work' + exit 1 +fi +dotnet remove TestProject.csproj package Google.Apis +cd ..