Skip to content

Commit 75b4a0e

Browse files
committed
Add diagnostic checks to all integration tests
1 parent a1a2d7c commit 75b4a0e

File tree

7 files changed

+31
-8
lines changed

7 files changed

+31
-8
lines changed
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
from create_database_utils import *
2+
from diagnostics_test_utils import *
23

3-
run_codeql_database_create(['dotnet build'], test_db="default-db", db=None, lang="csharp")
4+
run_codeql_database_create(['dotnet build'], db=None, lang="csharp")
5+
check_diagnostics()
Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
import os
22
from create_database_utils import *
3+
from diagnostics_test_utils import *
34

4-
run_codeql_database_create(['dotnet pack'], test_db="default-db", db=None, lang="csharp")
5+
run_codeql_database_create(['dotnet pack'], db=None, lang="csharp")
56

67
## Check that the NuGet package is created.
78
if not os.path.isfile("bin/Debug/dotnet_pack.1.0.0.nupkg"):
8-
raise Exception("The NuGet package was not created.")
9+
raise Exception("The NuGet package was not created.")
10+
11+
check_diagnostics()
Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
import os
22
from create_database_utils import *
3+
from diagnostics_test_utils import *
34

45
artifacts = 'bin/Temp'
5-
run_codeql_database_create([f"dotnet publish -o {artifacts}"], test_db="default-db", db=None, lang="csharp")
6+
run_codeql_database_create([f"dotnet publish -o {artifacts}"], db=None, lang="csharp")
67

78
## Check that the publish folder is created.
89
if not os.path.isdir(artifacts):
9-
raise Exception("The publish artifact folder was not created.")
10+
raise Exception("The publish artifact folder was not created.")
11+
12+
check_diagnostics()

csharp/ql/integration-tests/all-platforms/dotnet_run/test.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import os
22
from create_database_utils import *
3+
from diagnostics_test_utils import *
34

45
def run_codeql_database_create_stdout(args, dbname):
56
stdout = open(dbname + "file.txt", 'w+')
@@ -16,32 +17,40 @@ def check_build_out(msg, s):
1617
# no arguments
1718
s = run_codeql_database_create_stdout(['dotnet run'], "test-db")
1819
check_build_out("Default reply", s)
20+
check_diagnostics()
1921

2022
# no arguments, but `--`
2123
s = run_codeql_database_create_stdout(['dotnet clean', 'rm -rf test-db', 'dotnet run --'], "test2-db")
2224
check_build_out("Default reply", s)
25+
check_diagnostics(diagnostics_dir="test2-db/diagnostic")
2326

2427
# one argument, no `--`
2528
s = run_codeql_database_create_stdout(['dotnet clean', 'rm -rf test2-db', 'dotnet run hello'], "test3-db")
2629
check_build_out("Default reply", s)
30+
check_diagnostics(diagnostics_dir="test3-db/diagnostic")
2731

2832
# one argument, but `--`
2933
s = run_codeql_database_create_stdout(['dotnet clean', 'rm -rf test3-db', 'dotnet run -- hello'], "test4-db")
3034
check_build_out("Default reply", s)
35+
check_diagnostics(diagnostics_dir="test4-db/diagnostic")
3136

3237
# two arguments, no `--`
3338
s = run_codeql_database_create_stdout(['dotnet clean', 'rm -rf test4-db', 'dotnet run hello world'], "test5-db")
3439
check_build_out("hello, world", s)
40+
check_diagnostics(diagnostics_dir="test5-db/diagnostic")
3541

3642
# two arguments, and `--`
3743
s = run_codeql_database_create_stdout(['dotnet clean', 'rm -rf test5-db', 'dotnet run -- hello world'], "test6-db")
3844
check_build_out("hello, world", s)
45+
check_diagnostics(diagnostics_dir="test6-db/diagnostic")
3946

4047
# shared compilation enabled; tracer should override by changing the command
4148
# to `dotnet run -p:UseSharedCompilation=true -p:UseSharedCompilation=false -- hello world`
4249
s = run_codeql_database_create_stdout(['dotnet clean', 'rm -rf test6-db', 'dotnet run -p:UseSharedCompilation=true -- hello world'], "test7-db")
4350
check_build_out("hello, world", s)
51+
check_diagnostics(diagnostics_dir="test7-db/diagnostic")
4452

4553
# option passed into `dotnet run`
4654
s = run_codeql_database_create_stdout(['dotnet clean', 'rm -rf test7-db', 'dotnet build', 'dotnet run --no-build hello world'], "test8-db")
4755
check_build_out("hello, world", s)
56+
check_diagnostics(diagnostics_dir="test8-db/diagnostic")
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
from create_database_utils import *
2+
from diagnostics_test_utils import *
23

34
# force CodeQL to use MSBuild by setting `LGTM_INDEX_MSBUILD_TARGET`
4-
run_codeql_database_create([], test_db="default-db", db=None, lang="csharp", extra_env={ 'LGTM_INDEX_MSBUILD_TARGET': 'Build' })
5+
run_codeql_database_create([], db=None, lang="csharp", extra_env={ 'LGTM_INDEX_MSBUILD_TARGET': 'Build' })
6+
check_diagnostics()
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
from create_database_utils import *
2+
from diagnostics_test_utils import *
23

3-
run_codeql_database_create(['dotnet test'], test_db="default-db", db=None, lang="csharp")
4+
run_codeql_database_create(['dotnet test'], db=None, lang="csharp")
5+
check_diagnostics()
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
from create_database_utils import *
2+
from diagnostics_test_utils import *
23
import os
34

45
os.environ["PROJECT_TO_BUILD"] = "proj.csproj.no_auto"
56

6-
run_codeql_database_create([], test_db="default-db", db=None, lang="csharp")
7+
run_codeql_database_create([], db=None, lang="csharp")
8+
check_diagnostics()

0 commit comments

Comments
 (0)