Skip to content

Commit ac4ad0c

Browse files
committed
C#: Add test where build should not be interpreted as a SDK sub command.
1 parent 2457284 commit ac4ad0c

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Console.WriteLine(args[0]);
1+
Console.WriteLine($"<arguments>{string.Join(",", args)}</arguments>");
Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
from create_database_utils import *
22
from diagnostics_test_utils import *
33

4-
run_codeql_database_create(['dotnet build'], db=None, lang="csharp")
5-
check_diagnostics()
4+
def check_build_out(msg, s):
5+
if "[build-stdout] " + msg not in s:
6+
raise Exception("The C# tracer did not interpret the dotnet path-to-application command correctly.")
7+
8+
run_codeql_database_create(['dotnet build'], test_db="test1-db", lang="csharp")
9+
check_diagnostics(test_db="test1-db")
10+
11+
# This test checks that we don't inject any flags when running the application using `dotnet`
12+
my_dir = "my_program"
13+
my_abs_path = os.path.abspath(f"{my_dir}/dotnet_build.dll")
14+
s = run_codeql_database_create_stdout(['dotnet clean', 'rm -rf test1-db', 'dotnet build -o my_program', f'dotnet {my_abs_path} build is not a subcommand'], "test2-db", "csharp")
15+
check_build_out("<arguments>build,is,not,a,subcommand</arguments>", s)
16+
check_diagnostics(test_db="test2-db")

0 commit comments

Comments
 (0)