From 5572a039b1a2b0ec8b7d6737a5be953a9b0a17d5 Mon Sep 17 00:00:00 2001 From: Michael Nebel Date: Sat, 17 Sep 2022 14:54:02 +0200 Subject: [PATCH 1/3] C#: Integration test for 'dotnet publish'. --- .../all-platforms/dotnet_publish/Program.cs | 2 ++ .../all-platforms/dotnet_publish/dotnet_publish.csproj | 10 ++++++++++ .../all-platforms/dotnet_publish/test.py | 8 ++++++++ 3 files changed, 20 insertions(+) create mode 100644 csharp/ql/integration-tests/all-platforms/dotnet_publish/Program.cs create mode 100644 csharp/ql/integration-tests/all-platforms/dotnet_publish/dotnet_publish.csproj create mode 100644 csharp/ql/integration-tests/all-platforms/dotnet_publish/test.py diff --git a/csharp/ql/integration-tests/all-platforms/dotnet_publish/Program.cs b/csharp/ql/integration-tests/all-platforms/dotnet_publish/Program.cs new file mode 100644 index 00000000000..3751555cbd3 --- /dev/null +++ b/csharp/ql/integration-tests/all-platforms/dotnet_publish/Program.cs @@ -0,0 +1,2 @@ +// See https://aka.ms/new-console-template for more information +Console.WriteLine("Hello, World!"); diff --git a/csharp/ql/integration-tests/all-platforms/dotnet_publish/dotnet_publish.csproj b/csharp/ql/integration-tests/all-platforms/dotnet_publish/dotnet_publish.csproj new file mode 100644 index 00000000000..74abf5c9766 --- /dev/null +++ b/csharp/ql/integration-tests/all-platforms/dotnet_publish/dotnet_publish.csproj @@ -0,0 +1,10 @@ + + + + Exe + net6.0 + enable + enable + + + diff --git a/csharp/ql/integration-tests/all-platforms/dotnet_publish/test.py b/csharp/ql/integration-tests/all-platforms/dotnet_publish/test.py new file mode 100644 index 00000000000..ad040a8932b --- /dev/null +++ b/csharp/ql/integration-tests/all-platforms/dotnet_publish/test.py @@ -0,0 +1,8 @@ +import os +from create_database_utils import * + +run_codeql_database_create(['dotnet publish'], test_db="default-db", db=None, lang="csharp") + +## Check that the publish folder is created. +if not os.path.isdir("bin/Debug/net6.0/publish/"): + raise Exception("The publish artifact folder was not created.") From a5034c5109470d4da51f7c3ce0f36eceb764a331 Mon Sep 17 00:00:00 2001 From: Michael Nebel Date: Mon, 19 Sep 2022 11:27:34 +0200 Subject: [PATCH 2/3] C#: Integration test for 'dotnet pack'. --- .../all-platforms/dotnet_pack/Program.cs | 2 ++ .../all-platforms/dotnet_pack/dotnet_pack.csproj | 10 ++++++++++ .../all-platforms/dotnet_pack/test.py | 8 ++++++++ 3 files changed, 20 insertions(+) create mode 100644 csharp/ql/integration-tests/all-platforms/dotnet_pack/Program.cs create mode 100644 csharp/ql/integration-tests/all-platforms/dotnet_pack/dotnet_pack.csproj create mode 100644 csharp/ql/integration-tests/all-platforms/dotnet_pack/test.py diff --git a/csharp/ql/integration-tests/all-platforms/dotnet_pack/Program.cs b/csharp/ql/integration-tests/all-platforms/dotnet_pack/Program.cs new file mode 100644 index 00000000000..3751555cbd3 --- /dev/null +++ b/csharp/ql/integration-tests/all-platforms/dotnet_pack/Program.cs @@ -0,0 +1,2 @@ +// See https://aka.ms/new-console-template for more information +Console.WriteLine("Hello, World!"); diff --git a/csharp/ql/integration-tests/all-platforms/dotnet_pack/dotnet_pack.csproj b/csharp/ql/integration-tests/all-platforms/dotnet_pack/dotnet_pack.csproj new file mode 100644 index 00000000000..74abf5c9766 --- /dev/null +++ b/csharp/ql/integration-tests/all-platforms/dotnet_pack/dotnet_pack.csproj @@ -0,0 +1,10 @@ + + + + Exe + net6.0 + enable + enable + + + diff --git a/csharp/ql/integration-tests/all-platforms/dotnet_pack/test.py b/csharp/ql/integration-tests/all-platforms/dotnet_pack/test.py new file mode 100644 index 00000000000..9eac6efe388 --- /dev/null +++ b/csharp/ql/integration-tests/all-platforms/dotnet_pack/test.py @@ -0,0 +1,8 @@ +import os +from create_database_utils import * + +run_codeql_database_create(['dotnet pack'], test_db="default-db", db=None, lang="csharp") + +## Check that the NuGet package is created. +if not os.path.isfile("bin/Debug/dotnet_pack.1.0.0.nupkg"): + raise Exception("The NuGet package was not created.") From d29bc683dcfd2c0fb092f22f31100f65bd31f91e Mon Sep 17 00:00:00 2001 From: Michael Nebel Date: Tue, 20 Sep 2022 09:56:38 +0200 Subject: [PATCH 3/3] C#: Integration test for 'dotnet test'. --- .../posix-only/dotnet_test/UnitTest1.cs | 17 +++++++++++++++++ .../posix-only/dotnet_test/dotnet_test.csproj | 17 +++++++++++++++++ .../posix-only/dotnet_test/test.py | 3 +++ .../{all-platforms => }/qlpack.yml | 0 4 files changed, 37 insertions(+) create mode 100644 csharp/ql/integration-tests/posix-only/dotnet_test/UnitTest1.cs create mode 100644 csharp/ql/integration-tests/posix-only/dotnet_test/dotnet_test.csproj create mode 100644 csharp/ql/integration-tests/posix-only/dotnet_test/test.py rename csharp/ql/integration-tests/{all-platforms => }/qlpack.yml (100%) diff --git a/csharp/ql/integration-tests/posix-only/dotnet_test/UnitTest1.cs b/csharp/ql/integration-tests/posix-only/dotnet_test/UnitTest1.cs new file mode 100644 index 00000000000..4a8e236a7a0 --- /dev/null +++ b/csharp/ql/integration-tests/posix-only/dotnet_test/UnitTest1.cs @@ -0,0 +1,17 @@ +using NUnit.Framework; + +namespace dotnet_test; + +public class Tests +{ + [SetUp] + public void Setup() + { + } + + [Test] + public void Test1() + { + Assert.Pass(); + } +} \ No newline at end of file diff --git a/csharp/ql/integration-tests/posix-only/dotnet_test/dotnet_test.csproj b/csharp/ql/integration-tests/posix-only/dotnet_test/dotnet_test.csproj new file mode 100644 index 00000000000..50852359bb8 --- /dev/null +++ b/csharp/ql/integration-tests/posix-only/dotnet_test/dotnet_test.csproj @@ -0,0 +1,17 @@ + + + + net6.0 + enable + + false + + + + + + + + + + diff --git a/csharp/ql/integration-tests/posix-only/dotnet_test/test.py b/csharp/ql/integration-tests/posix-only/dotnet_test/test.py new file mode 100644 index 00000000000..6e3cdab30f7 --- /dev/null +++ b/csharp/ql/integration-tests/posix-only/dotnet_test/test.py @@ -0,0 +1,3 @@ +from create_database_utils import * + +run_codeql_database_create(['dotnet test'], test_db="default-db", db=None, lang="csharp") \ No newline at end of file diff --git a/csharp/ql/integration-tests/all-platforms/qlpack.yml b/csharp/ql/integration-tests/qlpack.yml similarity index 100% rename from csharp/ql/integration-tests/all-platforms/qlpack.yml rename to csharp/ql/integration-tests/qlpack.yml