11import os
22from create_database_utils import *
3+ from diagnostics_test_utils import *
34
45def 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
1718s = run_codeql_database_create_stdout (['dotnet run' ], "test-db" )
1819check_build_out ("Default reply" , s )
20+ check_diagnostics ()
1921
2022# no arguments, but `--`
2123s = run_codeql_database_create_stdout (['dotnet clean' , 'rm -rf test-db' , 'dotnet run --' ], "test2-db" )
2224check_build_out ("Default reply" , s )
25+ check_diagnostics (diagnostics_dir = "test2-db/diagnostic" )
2326
2427# one argument, no `--`
2528s = run_codeql_database_create_stdout (['dotnet clean' , 'rm -rf test2-db' , 'dotnet run hello' ], "test3-db" )
2629check_build_out ("Default reply" , s )
30+ check_diagnostics (diagnostics_dir = "test3-db/diagnostic" )
2731
2832# one argument, but `--`
2933s = run_codeql_database_create_stdout (['dotnet clean' , 'rm -rf test3-db' , 'dotnet run -- hello' ], "test4-db" )
3034check_build_out ("Default reply" , s )
35+ check_diagnostics (diagnostics_dir = "test4-db/diagnostic" )
3136
3237# two arguments, no `--`
3338s = run_codeql_database_create_stdout (['dotnet clean' , 'rm -rf test4-db' , 'dotnet run hello world' ], "test5-db" )
3439check_build_out ("hello, world" , s )
40+ check_diagnostics (diagnostics_dir = "test5-db/diagnostic" )
3541
3642# two arguments, and `--`
3743s = run_codeql_database_create_stdout (['dotnet clean' , 'rm -rf test5-db' , 'dotnet run -- hello world' ], "test6-db" )
3844check_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`
4249s = run_codeql_database_create_stdout (['dotnet clean' , 'rm -rf test6-db' , 'dotnet run -p:UseSharedCompilation=true -- hello world' ], "test7-db" )
4350check_build_out ("hello, world" , s )
51+ check_diagnostics (diagnostics_dir = "test7-db/diagnostic" )
4452
4553# option passed into `dotnet run`
4654s = run_codeql_database_create_stdout (['dotnet clean' , 'rm -rf test7-db' , 'dotnet build' , 'dotnet run --no-build hello world' ], "test8-db" )
4755check_build_out ("hello, world" , s )
56+ check_diagnostics (diagnostics_dir = "test8-db/diagnostic" )
0 commit comments