mirror of
https://github.com/github/codeql.git
synced 2026-07-02 01:55:31 +02:00
Merge pull request #22087 from jketema/subst
Add Windows integration tests showing that `subst` is handled inconsistently
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
class Program
|
||||
{
|
||||
static void Main() {}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"sdk": {
|
||||
"version": "9.0.201"
|
||||
}
|
||||
}
|
||||
8
csharp/ql/integration-tests/windows/subst/file.expected
Normal file
8
csharp/ql/integration-tests/windows/subst/file.expected
Normal file
@@ -0,0 +1,8 @@
|
||||
| code/Program.cs:0:0:0:0 | code/Program.cs | |
|
||||
| code/obj/Debug/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs:0:0:0:0 | code/obj/Debug/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs | |
|
||||
| code/obj/Debug/net9.0/dotnet_build.AssemblyInfo.cs:0:0:0:0 | code/obj/Debug/net9.0/dotnet_build.AssemblyInfo.cs | |
|
||||
| code/obj/Debug/net9.0/dotnet_build.GlobalUsings.g.cs:0:0:0:0 | code/obj/Debug/net9.0/dotnet_build.GlobalUsings.g.cs | |
|
||||
| code/obj/Debug/net9.0/dotnet_build.dll:0:0:0:0 | code/obj/Debug/net9.0/dotnet_build.dll | |
|
||||
| file://:0:0:0:0 | | |
|
||||
| file://Z:/dotnet_build.csproj:0:0:0:0 | Z:/dotnet_build.csproj | relative |
|
||||
| file://Z:/obj/dotnet_build.csproj.nuget.g.props:0:0:0:0 | Z:/obj/dotnet_build.csproj.nuget.g.props | relative |
|
||||
7
csharp/ql/integration-tests/windows/subst/file.ql
Normal file
7
csharp/ql/integration-tests/windows/subst/file.ql
Normal file
@@ -0,0 +1,7 @@
|
||||
import csharp
|
||||
|
||||
from File f, string relative
|
||||
where
|
||||
not f.getURL().matches("file://C:/Program Files/%") and
|
||||
if exists(f.getRelativePath()) then relative = "relative" else relative = ""
|
||||
select f, relative
|
||||
7
csharp/ql/integration-tests/windows/subst/test.py
Normal file
7
csharp/ql/integration-tests/windows/subst/test.py
Normal file
@@ -0,0 +1,7 @@
|
||||
import runs_on
|
||||
|
||||
|
||||
@runs_on.windows
|
||||
def test(codeql, csharp, cwd, subst_drive):
|
||||
drive = subst_drive(cwd / "code")
|
||||
codeql.database.create(source_root=drive)
|
||||
3
go/ql/integration-tests/subst/code/main.go
Normal file
3
go/ql/integration-tests/subst/code/main.go
Normal file
@@ -0,0 +1,3 @@
|
||||
package main
|
||||
|
||||
func main() {}
|
||||
1
go/ql/integration-tests/subst/file.expected
Normal file
1
go/ql/integration-tests/subst/file.expected
Normal file
@@ -0,0 +1 @@
|
||||
| file://Z:/main.go:0:0:0:0 | Z:/main.go | relative |
|
||||
5
go/ql/integration-tests/subst/file.ql
Normal file
5
go/ql/integration-tests/subst/file.ql
Normal file
@@ -0,0 +1,5 @@
|
||||
import go
|
||||
|
||||
from File f, string relative
|
||||
where if exists(f.getRelativePath()) then relative = "relative" else relative = ""
|
||||
select f, relative
|
||||
7
go/ql/integration-tests/subst/test.py
Normal file
7
go/ql/integration-tests/subst/test.py
Normal file
@@ -0,0 +1,7 @@
|
||||
import runs_on
|
||||
|
||||
|
||||
@runs_on.windows
|
||||
def test(codeql, go, cwd, subst_drive):
|
||||
drive = subst_drive(cwd / "code")
|
||||
codeql.database.create(command="go build main.go", source_root=drive)
|
||||
4
java/ql/integration-tests/java/subst/code/test1.java
Normal file
4
java/ql/integration-tests/java/subst/code/test1.java
Normal file
@@ -0,0 +1,4 @@
|
||||
class Test {
|
||||
public static void main(String[] args) {
|
||||
}
|
||||
}
|
||||
1
java/ql/integration-tests/java/subst/code/test2.kt
Normal file
1
java/ql/integration-tests/java/subst/code/test2.kt
Normal file
@@ -0,0 +1 @@
|
||||
fun main() {}
|
||||
5
java/ql/integration-tests/java/subst/file.expected
Normal file
5
java/ql/integration-tests/java/subst/file.expected
Normal file
@@ -0,0 +1,5 @@
|
||||
| file://:0:0:0:0 | | |
|
||||
| file://:0:0:0:0 | | |
|
||||
| file://Z:/Test.class:0:0:0:0 | Test | relative |
|
||||
| file://Z:/test1.java:0:0:0:0 | test1 | relative |
|
||||
| file://Z:/test2.kt:0:0:0:0 | test2 | relative |
|
||||
9
java/ql/integration-tests/java/subst/file.ql
Normal file
9
java/ql/integration-tests/java/subst/file.ql
Normal file
@@ -0,0 +1,9 @@
|
||||
import java
|
||||
|
||||
from File f, string relative
|
||||
where
|
||||
not f.getURL().matches("file:///modules/%") and
|
||||
not f.getURL().matches("file:///!unknown-binary-location/kotlin/%") and
|
||||
not f.getURL().matches("%/ql/java/kotlin-extractor/%") and
|
||||
if exists(f.getRelativePath()) then relative = "relative" else relative = ""
|
||||
select f, relative
|
||||
7
java/ql/integration-tests/java/subst/test.py
Normal file
7
java/ql/integration-tests/java/subst/test.py
Normal file
@@ -0,0 +1,7 @@
|
||||
import runs_on
|
||||
|
||||
|
||||
@runs_on.windows
|
||||
def test(codeql, java, cwd, subst_drive):
|
||||
drive = subst_drive(cwd / "code")
|
||||
codeql.database.create(command=["javac test1.java", "kotlinc test2.kt"], source_root=drive)
|
||||
1
javascript/ql/integration-tests/subst/code/main.js
Normal file
1
javascript/ql/integration-tests/subst/code/main.js
Normal file
@@ -0,0 +1 @@
|
||||
function interesting() { }
|
||||
1
javascript/ql/integration-tests/subst/code/test.ts
Normal file
1
javascript/ql/integration-tests/subst/code/test.ts
Normal file
@@ -0,0 +1 @@
|
||||
0
|
||||
2
javascript/ql/integration-tests/subst/file.expected
Normal file
2
javascript/ql/integration-tests/subst/file.expected
Normal file
@@ -0,0 +1,2 @@
|
||||
| file://Z:/main.js:0:0:0:0 | Z:/main.js | relative |
|
||||
| file://Z:/test.ts:0:0:0:0 | Z:/test.ts | relative |
|
||||
7
javascript/ql/integration-tests/subst/file.ql
Normal file
7
javascript/ql/integration-tests/subst/file.ql
Normal file
@@ -0,0 +1,7 @@
|
||||
import javascript
|
||||
|
||||
from File f, string relative
|
||||
where
|
||||
not f.getURL().matches("%/target/intree/%") and
|
||||
if exists(f.getRelativePath()) then relative = "relative" else relative = ""
|
||||
select f, relative
|
||||
7
javascript/ql/integration-tests/subst/test.py
Normal file
7
javascript/ql/integration-tests/subst/test.py
Normal file
@@ -0,0 +1,7 @@
|
||||
import runs_on
|
||||
|
||||
|
||||
@runs_on.windows
|
||||
def test(codeql, javascript, cwd, subst_drive):
|
||||
drive = subst_drive(cwd / "code")
|
||||
codeql.database.create(source_root=drive)
|
||||
1
python/ql/integration-tests/subst/code/main.py
Normal file
1
python/ql/integration-tests/subst/code/main.py
Normal file
@@ -0,0 +1 @@
|
||||
print(0)
|
||||
1
python/ql/integration-tests/subst/file.expected
Normal file
1
python/ql/integration-tests/subst/file.expected
Normal file
@@ -0,0 +1 @@
|
||||
| code/main.py:0:0:0:0 | code/main.py | |
|
||||
5
python/ql/integration-tests/subst/file.ql
Normal file
5
python/ql/integration-tests/subst/file.ql
Normal file
@@ -0,0 +1,5 @@
|
||||
import python
|
||||
|
||||
from File f, string relative
|
||||
where if exists(f.getRelativePath()) then relative = "relative" else relative = ""
|
||||
select f, relative
|
||||
7
python/ql/integration-tests/subst/test.py
Normal file
7
python/ql/integration-tests/subst/test.py
Normal file
@@ -0,0 +1,7 @@
|
||||
import runs_on
|
||||
|
||||
|
||||
@runs_on.windows
|
||||
def test(codeql, python, cwd, subst_drive):
|
||||
drive = subst_drive(cwd / "code")
|
||||
codeql.database.create(source_root=drive)
|
||||
1
ruby/ql/integration-tests/subst/code/test.rb
Normal file
1
ruby/ql/integration-tests/subst/code/test.rb
Normal file
@@ -0,0 +1 @@
|
||||
0
|
||||
2
ruby/ql/integration-tests/subst/file.expected
Normal file
2
ruby/ql/integration-tests/subst/file.expected
Normal file
@@ -0,0 +1,2 @@
|
||||
| code/test.rb:0:0:0:0 | code/test.rb | |
|
||||
| file://:0:0:0:0 | | |
|
||||
5
ruby/ql/integration-tests/subst/file.ql
Normal file
5
ruby/ql/integration-tests/subst/file.ql
Normal file
@@ -0,0 +1,5 @@
|
||||
import ruby
|
||||
|
||||
from File f, string relative
|
||||
where if exists(f.getRelativePath()) then relative = "relative" else relative = ""
|
||||
select f, relative
|
||||
7
ruby/ql/integration-tests/subst/test.py
Normal file
7
ruby/ql/integration-tests/subst/test.py
Normal file
@@ -0,0 +1,7 @@
|
||||
import runs_on
|
||||
|
||||
|
||||
@runs_on.windows
|
||||
def test(codeql, ruby, cwd, subst_drive):
|
||||
drive = subst_drive(cwd / "code")
|
||||
codeql.database.create(source_root=drive)
|
||||
1
rust/ql/integration-tests/subst/code/test.rs
Normal file
1
rust/ql/integration-tests/subst/code/test.rs
Normal file
@@ -0,0 +1 @@
|
||||
fn main() {}
|
||||
2
rust/ql/integration-tests/subst/file.expected
Normal file
2
rust/ql/integration-tests/subst/file.expected
Normal file
@@ -0,0 +1,2 @@
|
||||
| code/test.rs:0:0:0:0 | code/test.rs | |
|
||||
| file://:0:0:0:0 | | |
|
||||
7
rust/ql/integration-tests/subst/file.ql
Normal file
7
rust/ql/integration-tests/subst/file.ql
Normal file
@@ -0,0 +1,7 @@
|
||||
import rust
|
||||
|
||||
from File f, string relative
|
||||
where
|
||||
not f.getURL().matches("%/target/intree/%") and
|
||||
if exists(f.getRelativePath()) then relative = "relative" else relative = ""
|
||||
select f, relative
|
||||
7
rust/ql/integration-tests/subst/test.py
Normal file
7
rust/ql/integration-tests/subst/test.py
Normal file
@@ -0,0 +1,7 @@
|
||||
import runs_on
|
||||
|
||||
|
||||
@runs_on.windows
|
||||
def test(codeql, rust, cwd, subst_drive):
|
||||
drive = subst_drive(cwd / "code")
|
||||
codeql.database.create(source_root=drive)
|
||||
Reference in New Issue
Block a user