From aec06c81004de90d33e54b040c82962fd533cfc5 Mon Sep 17 00:00:00 2001 From: Cornelius Riemenschneider Date: Mon, 5 Aug 2024 09:48:21 +0200 Subject: [PATCH 1/7] Port go tests. --- .../go/bazel-sample-1/force_sequential_test_execution | 2 -- .../all-platforms/go/bazel-sample-1/test.py | 5 ++--- .../go/bazel-sample-2/force_sequential_test_execution | 2 -- .../all-platforms/go/bazel-sample-2/test.py | 5 ++--- .../build-constraints-exclude-all-go-files/test.py | 8 +++++--- .../go/diagnostics/force_sequential_test_execution | 2 -- .../diagnostics/go-files-found-not-processed/test.py | 8 +++++--- .../go/diagnostics/invalid-toolchain-version/test.py | 6 +++--- .../go/diagnostics/newer-go-version-needed/test.py | 8 +++++--- .../go/diagnostics/no-go-files-found/test.py | 8 +++++--- .../diagnostics/package-not-found-with-go-mod/test.py | 8 +++++--- .../package-not-found-without-go-mod/test.py | 8 +++++--- .../go/diagnostics/unsupported-relative-path/test.py | 8 +++++--- .../go/extract-vendor/force_sequential_test_execution | 2 -- .../all-platforms/go/extract-vendor/test.py | 8 +++++--- .../force_sequential_test_execution | 2 -- .../go/go-get-without-modules-sample/test.py | 5 ++--- .../go/go-mod-sample/force_sequential_test_execution | 2 -- .../all-platforms/go/go-mod-sample/test.py | 5 ++--- .../force_sequential_test_execution | 2 -- .../all-platforms/go/go-mod-without-version/test.py | 5 ++--- .../all-platforms/go/go-version-bump/test.py | 5 ++--- .../go/make-sample/force_sequential_test_execution | 2 -- .../all-platforms/go/make-sample/test.py | 5 ++--- .../go/mixed-layout/force_sequential_test_execution | 2 -- .../all-platforms/go/mixed-layout/test.py | 5 ++--- .../go/ninja-sample/force_sequential_test_execution | 2 -- .../all-platforms/go/ninja-sample/test.py | 5 ++--- go/ql/integration-tests/all-platforms/go/qlpack.yml | 5 ----- .../resolve-build-environment/newer-go-needed/test.py | 7 +++++-- .../force_sequential_test_execution | 2 -- .../go/single-go-mod-and-go-files-not-under-it/test.py | 5 ++--- .../force_sequential_test_execution | 2 -- .../all-platforms/go/single-go-mod-in-root/test.py | 5 ++--- .../force_sequential_test_execution | 2 -- .../all-platforms/go/single-go-mod-not-in-root/test.py | 5 ++--- .../force_sequential_test_execution | 2 -- .../go/single-go-work-not-in-root/test.py | 5 ++--- .../force_sequential_test_execution | 2 -- .../go/two-go-mods-nested-none-in-root/test.py | 5 ++--- .../force_sequential_test_execution | 2 -- .../go/two-go-mods-nested-one-in-root/test.py | 5 ++--- .../force_sequential_test_execution | 2 -- .../all-platforms/go/two-go-mods-not-nested/test.py | 5 ++--- .../force_sequential_test_execution | 2 -- .../all-platforms/go/two-go-mods-one-failure/test.py | 5 ++--- go/ql/integration-tests/legacy | 1 - .../go/dep-sample/force_sequential_test_execution | 2 -- .../integration-tests/linux-only/go/dep-sample/test.py | 10 +++++++--- .../linux-only/go/glide-sample/test.py | 10 +++++++--- go/ql/integration-tests/linux-only/go/qlpack.yml | 5 ----- 51 files changed, 96 insertions(+), 135 deletions(-) delete mode 100644 go/ql/integration-tests/all-platforms/go/bazel-sample-1/force_sequential_test_execution delete mode 100644 go/ql/integration-tests/all-platforms/go/bazel-sample-2/force_sequential_test_execution delete mode 100644 go/ql/integration-tests/all-platforms/go/diagnostics/force_sequential_test_execution delete mode 100644 go/ql/integration-tests/all-platforms/go/extract-vendor/force_sequential_test_execution delete mode 100644 go/ql/integration-tests/all-platforms/go/go-get-without-modules-sample/force_sequential_test_execution delete mode 100644 go/ql/integration-tests/all-platforms/go/go-mod-sample/force_sequential_test_execution delete mode 100644 go/ql/integration-tests/all-platforms/go/go-mod-without-version/force_sequential_test_execution delete mode 100644 go/ql/integration-tests/all-platforms/go/make-sample/force_sequential_test_execution delete mode 100644 go/ql/integration-tests/all-platforms/go/mixed-layout/force_sequential_test_execution delete mode 100644 go/ql/integration-tests/all-platforms/go/ninja-sample/force_sequential_test_execution delete mode 100644 go/ql/integration-tests/all-platforms/go/qlpack.yml delete mode 100644 go/ql/integration-tests/all-platforms/go/single-go-mod-and-go-files-not-under-it/force_sequential_test_execution delete mode 100644 go/ql/integration-tests/all-platforms/go/single-go-mod-in-root/force_sequential_test_execution delete mode 100644 go/ql/integration-tests/all-platforms/go/single-go-mod-not-in-root/force_sequential_test_execution delete mode 100644 go/ql/integration-tests/all-platforms/go/single-go-work-not-in-root/force_sequential_test_execution delete mode 100644 go/ql/integration-tests/all-platforms/go/two-go-mods-nested-none-in-root/force_sequential_test_execution delete mode 100644 go/ql/integration-tests/all-platforms/go/two-go-mods-nested-one-in-root/force_sequential_test_execution delete mode 100644 go/ql/integration-tests/all-platforms/go/two-go-mods-not-nested/force_sequential_test_execution delete mode 100644 go/ql/integration-tests/all-platforms/go/two-go-mods-one-failure/force_sequential_test_execution delete mode 100644 go/ql/integration-tests/legacy delete mode 100644 go/ql/integration-tests/linux-only/go/dep-sample/force_sequential_test_execution delete mode 100644 go/ql/integration-tests/linux-only/go/qlpack.yml diff --git a/go/ql/integration-tests/all-platforms/go/bazel-sample-1/force_sequential_test_execution b/go/ql/integration-tests/all-platforms/go/bazel-sample-1/force_sequential_test_execution deleted file mode 100644 index b3655f44f96..00000000000 --- a/go/ql/integration-tests/all-platforms/go/bazel-sample-1/force_sequential_test_execution +++ /dev/null @@ -1,2 +0,0 @@ -# go get has been observed to sometimes fail when multiple tests try to simultaneously fetch the same package. -goget \ No newline at end of file diff --git a/go/ql/integration-tests/all-platforms/go/bazel-sample-1/test.py b/go/ql/integration-tests/all-platforms/go/bazel-sample-1/test.py index 696df6f6a22..e00c3a08d03 100644 --- a/go/ql/integration-tests/all-platforms/go/bazel-sample-1/test.py +++ b/go/ql/integration-tests/all-platforms/go/bazel-sample-1/test.py @@ -1,3 +1,2 @@ -from go_integration_test import * - -go_integration_test() +def test(codeql, go): + codeql.database.create(source_root="src") diff --git a/go/ql/integration-tests/all-platforms/go/bazel-sample-2/force_sequential_test_execution b/go/ql/integration-tests/all-platforms/go/bazel-sample-2/force_sequential_test_execution deleted file mode 100644 index b3655f44f96..00000000000 --- a/go/ql/integration-tests/all-platforms/go/bazel-sample-2/force_sequential_test_execution +++ /dev/null @@ -1,2 +0,0 @@ -# go get has been observed to sometimes fail when multiple tests try to simultaneously fetch the same package. -goget \ No newline at end of file diff --git a/go/ql/integration-tests/all-platforms/go/bazel-sample-2/test.py b/go/ql/integration-tests/all-platforms/go/bazel-sample-2/test.py index 696df6f6a22..e00c3a08d03 100644 --- a/go/ql/integration-tests/all-platforms/go/bazel-sample-2/test.py +++ b/go/ql/integration-tests/all-platforms/go/bazel-sample-2/test.py @@ -1,3 +1,2 @@ -from go_integration_test import * - -go_integration_test() +def test(codeql, go): + codeql.database.create(source_root="src") diff --git a/go/ql/integration-tests/all-platforms/go/diagnostics/build-constraints-exclude-all-go-files/test.py b/go/ql/integration-tests/all-platforms/go/diagnostics/build-constraints-exclude-all-go-files/test.py index a8fa202a409..4e875926cf7 100644 --- a/go/ql/integration-tests/all-platforms/go/diagnostics/build-constraints-exclude-all-go-files/test.py +++ b/go/ql/integration-tests/all-platforms/go/diagnostics/build-constraints-exclude-all-go-files/test.py @@ -1,6 +1,8 @@ import os +import pytest -from go_integration_test import * -os.environ['LGTM_INDEX_IMPORT_PATH'] = "test" -go_integration_test(source="work", db=None) +@pytest.mark.resolve_build_environment(source_root="work") +def test(codeql, go): + os.environ["LGTM_INDEX_IMPORT_PATH"] = "test" + codeql.database.create(source_root="work") diff --git a/go/ql/integration-tests/all-platforms/go/diagnostics/force_sequential_test_execution b/go/ql/integration-tests/all-platforms/go/diagnostics/force_sequential_test_execution deleted file mode 100644 index b3655f44f96..00000000000 --- a/go/ql/integration-tests/all-platforms/go/diagnostics/force_sequential_test_execution +++ /dev/null @@ -1,2 +0,0 @@ -# go get has been observed to sometimes fail when multiple tests try to simultaneously fetch the same package. -goget \ No newline at end of file diff --git a/go/ql/integration-tests/all-platforms/go/diagnostics/go-files-found-not-processed/test.py b/go/ql/integration-tests/all-platforms/go/diagnostics/go-files-found-not-processed/test.py index 36a6787175d..4e875926cf7 100644 --- a/go/ql/integration-tests/all-platforms/go/diagnostics/go-files-found-not-processed/test.py +++ b/go/ql/integration-tests/all-platforms/go/diagnostics/go-files-found-not-processed/test.py @@ -1,6 +1,8 @@ import os +import pytest -from go_integration_test import * -os.environ['LGTM_INDEX_IMPORT_PATH'] = "test" -go_integration_test(source="work") +@pytest.mark.resolve_build_environment(source_root="work") +def test(codeql, go): + os.environ["LGTM_INDEX_IMPORT_PATH"] = "test" + codeql.database.create(source_root="work") diff --git a/go/ql/integration-tests/all-platforms/go/diagnostics/invalid-toolchain-version/test.py b/go/ql/integration-tests/all-platforms/go/diagnostics/invalid-toolchain-version/test.py index 90dfe6aaebd..44aa92d6758 100644 --- a/go/ql/integration-tests/all-platforms/go/diagnostics/invalid-toolchain-version/test.py +++ b/go/ql/integration-tests/all-platforms/go/diagnostics/invalid-toolchain-version/test.py @@ -1,6 +1,6 @@ import os -from go_integration_test import * -os.environ['LGTM_INDEX_IMPORT_PATH'] = "test" -go_integration_test() +def test(codeql, go): + os.environ["LGTM_INDEX_IMPORT_PATH"] = "test" + codeql.database.create(source_root="src") diff --git a/go/ql/integration-tests/all-platforms/go/diagnostics/newer-go-version-needed/test.py b/go/ql/integration-tests/all-platforms/go/diagnostics/newer-go-version-needed/test.py index 636f8ec2cf4..53ea788dad9 100644 --- a/go/ql/integration-tests/all-platforms/go/diagnostics/newer-go-version-needed/test.py +++ b/go/ql/integration-tests/all-platforms/go/diagnostics/newer-go-version-needed/test.py @@ -1,6 +1,8 @@ import os +import pytest -from go_integration_test import * -os.environ['LGTM_INDEX_IMPORT_PATH'] = "test" -go_integration_test(source="work", db=None, runFunction=runUnsuccessfully) +@pytest.mark.resolve_build_environment(source_root="work") +def test(codeql, go): + os.environ["LGTM_INDEX_IMPORT_PATH"] = "test" + codeql.database.create(source_root="work", _assert_failure=True) diff --git a/go/ql/integration-tests/all-platforms/go/diagnostics/no-go-files-found/test.py b/go/ql/integration-tests/all-platforms/go/diagnostics/no-go-files-found/test.py index 636f8ec2cf4..53ea788dad9 100644 --- a/go/ql/integration-tests/all-platforms/go/diagnostics/no-go-files-found/test.py +++ b/go/ql/integration-tests/all-platforms/go/diagnostics/no-go-files-found/test.py @@ -1,6 +1,8 @@ import os +import pytest -from go_integration_test import * -os.environ['LGTM_INDEX_IMPORT_PATH'] = "test" -go_integration_test(source="work", db=None, runFunction=runUnsuccessfully) +@pytest.mark.resolve_build_environment(source_root="work") +def test(codeql, go): + os.environ["LGTM_INDEX_IMPORT_PATH"] = "test" + codeql.database.create(source_root="work", _assert_failure=True) diff --git a/go/ql/integration-tests/all-platforms/go/diagnostics/package-not-found-with-go-mod/test.py b/go/ql/integration-tests/all-platforms/go/diagnostics/package-not-found-with-go-mod/test.py index a8fa202a409..4e875926cf7 100644 --- a/go/ql/integration-tests/all-platforms/go/diagnostics/package-not-found-with-go-mod/test.py +++ b/go/ql/integration-tests/all-platforms/go/diagnostics/package-not-found-with-go-mod/test.py @@ -1,6 +1,8 @@ import os +import pytest -from go_integration_test import * -os.environ['LGTM_INDEX_IMPORT_PATH'] = "test" -go_integration_test(source="work", db=None) +@pytest.mark.resolve_build_environment(source_root="work") +def test(codeql, go): + os.environ["LGTM_INDEX_IMPORT_PATH"] = "test" + codeql.database.create(source_root="work") diff --git a/go/ql/integration-tests/all-platforms/go/diagnostics/package-not-found-without-go-mod/test.py b/go/ql/integration-tests/all-platforms/go/diagnostics/package-not-found-without-go-mod/test.py index a8fa202a409..4e875926cf7 100644 --- a/go/ql/integration-tests/all-platforms/go/diagnostics/package-not-found-without-go-mod/test.py +++ b/go/ql/integration-tests/all-platforms/go/diagnostics/package-not-found-without-go-mod/test.py @@ -1,6 +1,8 @@ import os +import pytest -from go_integration_test import * -os.environ['LGTM_INDEX_IMPORT_PATH'] = "test" -go_integration_test(source="work", db=None) +@pytest.mark.resolve_build_environment(source_root="work") +def test(codeql, go): + os.environ["LGTM_INDEX_IMPORT_PATH"] = "test" + codeql.database.create(source_root="work") diff --git a/go/ql/integration-tests/all-platforms/go/diagnostics/unsupported-relative-path/test.py b/go/ql/integration-tests/all-platforms/go/diagnostics/unsupported-relative-path/test.py index 365885b4c45..c0a0f46fcca 100644 --- a/go/ql/integration-tests/all-platforms/go/diagnostics/unsupported-relative-path/test.py +++ b/go/ql/integration-tests/all-platforms/go/diagnostics/unsupported-relative-path/test.py @@ -1,6 +1,8 @@ import os +import pytest -from go_integration_test import * -os.environ['GITHUB_REPOSITORY'] = "a/b" -go_integration_test(source="work", db=None) +@pytest.mark.resolve_build_environment(source_root="work") +def test(codeql, go): + os.environ["GITHUB_REPOSITORY"] = "a/b" + codeql.database.create(source_root="work") diff --git a/go/ql/integration-tests/all-platforms/go/extract-vendor/force_sequential_test_execution b/go/ql/integration-tests/all-platforms/go/extract-vendor/force_sequential_test_execution deleted file mode 100644 index 47ca9929099..00000000000 --- a/go/ql/integration-tests/all-platforms/go/extract-vendor/force_sequential_test_execution +++ /dev/null @@ -1,2 +0,0 @@ -# go get has been observed to sometimes fail when multiple tests try to simultaneously fetch the same package. -goget diff --git a/go/ql/integration-tests/all-platforms/go/extract-vendor/test.py b/go/ql/integration-tests/all-platforms/go/extract-vendor/test.py index 2bd482201b8..04dfd61c38f 100644 --- a/go/ql/integration-tests/all-platforms/go/extract-vendor/test.py +++ b/go/ql/integration-tests/all-platforms/go/extract-vendor/test.py @@ -1,4 +1,6 @@ -from go_integration_test import * +import os -os.environ['CODEQL_EXTRACTOR_GO_EXTRACT_VENDOR_DIRS'] = "true" -go_integration_test() + +def test(codeql, go): + os.environ["CODEQL_EXTRACTOR_GO_EXTRACT_VENDOR_DIRS"] = "true" + codeql.database.create(source_root="src") diff --git a/go/ql/integration-tests/all-platforms/go/go-get-without-modules-sample/force_sequential_test_execution b/go/ql/integration-tests/all-platforms/go/go-get-without-modules-sample/force_sequential_test_execution deleted file mode 100644 index b3655f44f96..00000000000 --- a/go/ql/integration-tests/all-platforms/go/go-get-without-modules-sample/force_sequential_test_execution +++ /dev/null @@ -1,2 +0,0 @@ -# go get has been observed to sometimes fail when multiple tests try to simultaneously fetch the same package. -goget \ No newline at end of file diff --git a/go/ql/integration-tests/all-platforms/go/go-get-without-modules-sample/test.py b/go/ql/integration-tests/all-platforms/go/go-get-without-modules-sample/test.py index 696df6f6a22..e00c3a08d03 100644 --- a/go/ql/integration-tests/all-platforms/go/go-get-without-modules-sample/test.py +++ b/go/ql/integration-tests/all-platforms/go/go-get-without-modules-sample/test.py @@ -1,3 +1,2 @@ -from go_integration_test import * - -go_integration_test() +def test(codeql, go): + codeql.database.create(source_root="src") diff --git a/go/ql/integration-tests/all-platforms/go/go-mod-sample/force_sequential_test_execution b/go/ql/integration-tests/all-platforms/go/go-mod-sample/force_sequential_test_execution deleted file mode 100644 index b3655f44f96..00000000000 --- a/go/ql/integration-tests/all-platforms/go/go-mod-sample/force_sequential_test_execution +++ /dev/null @@ -1,2 +0,0 @@ -# go get has been observed to sometimes fail when multiple tests try to simultaneously fetch the same package. -goget \ No newline at end of file diff --git a/go/ql/integration-tests/all-platforms/go/go-mod-sample/test.py b/go/ql/integration-tests/all-platforms/go/go-mod-sample/test.py index 696df6f6a22..e00c3a08d03 100644 --- a/go/ql/integration-tests/all-platforms/go/go-mod-sample/test.py +++ b/go/ql/integration-tests/all-platforms/go/go-mod-sample/test.py @@ -1,3 +1,2 @@ -from go_integration_test import * - -go_integration_test() +def test(codeql, go): + codeql.database.create(source_root="src") diff --git a/go/ql/integration-tests/all-platforms/go/go-mod-without-version/force_sequential_test_execution b/go/ql/integration-tests/all-platforms/go/go-mod-without-version/force_sequential_test_execution deleted file mode 100644 index 47ca9929099..00000000000 --- a/go/ql/integration-tests/all-platforms/go/go-mod-without-version/force_sequential_test_execution +++ /dev/null @@ -1,2 +0,0 @@ -# go get has been observed to sometimes fail when multiple tests try to simultaneously fetch the same package. -goget diff --git a/go/ql/integration-tests/all-platforms/go/go-mod-without-version/test.py b/go/ql/integration-tests/all-platforms/go/go-mod-without-version/test.py index 696df6f6a22..e00c3a08d03 100644 --- a/go/ql/integration-tests/all-platforms/go/go-mod-without-version/test.py +++ b/go/ql/integration-tests/all-platforms/go/go-mod-without-version/test.py @@ -1,3 +1,2 @@ -from go_integration_test import * - -go_integration_test() +def test(codeql, go): + codeql.database.create(source_root="src") diff --git a/go/ql/integration-tests/all-platforms/go/go-version-bump/test.py b/go/ql/integration-tests/all-platforms/go/go-version-bump/test.py index 696df6f6a22..e00c3a08d03 100644 --- a/go/ql/integration-tests/all-platforms/go/go-version-bump/test.py +++ b/go/ql/integration-tests/all-platforms/go/go-version-bump/test.py @@ -1,3 +1,2 @@ -from go_integration_test import * - -go_integration_test() +def test(codeql, go): + codeql.database.create(source_root="src") diff --git a/go/ql/integration-tests/all-platforms/go/make-sample/force_sequential_test_execution b/go/ql/integration-tests/all-platforms/go/make-sample/force_sequential_test_execution deleted file mode 100644 index b3655f44f96..00000000000 --- a/go/ql/integration-tests/all-platforms/go/make-sample/force_sequential_test_execution +++ /dev/null @@ -1,2 +0,0 @@ -# go get has been observed to sometimes fail when multiple tests try to simultaneously fetch the same package. -goget \ No newline at end of file diff --git a/go/ql/integration-tests/all-platforms/go/make-sample/test.py b/go/ql/integration-tests/all-platforms/go/make-sample/test.py index 696df6f6a22..e00c3a08d03 100644 --- a/go/ql/integration-tests/all-platforms/go/make-sample/test.py +++ b/go/ql/integration-tests/all-platforms/go/make-sample/test.py @@ -1,3 +1,2 @@ -from go_integration_test import * - -go_integration_test() +def test(codeql, go): + codeql.database.create(source_root="src") diff --git a/go/ql/integration-tests/all-platforms/go/mixed-layout/force_sequential_test_execution b/go/ql/integration-tests/all-platforms/go/mixed-layout/force_sequential_test_execution deleted file mode 100644 index 47ca9929099..00000000000 --- a/go/ql/integration-tests/all-platforms/go/mixed-layout/force_sequential_test_execution +++ /dev/null @@ -1,2 +0,0 @@ -# go get has been observed to sometimes fail when multiple tests try to simultaneously fetch the same package. -goget diff --git a/go/ql/integration-tests/all-platforms/go/mixed-layout/test.py b/go/ql/integration-tests/all-platforms/go/mixed-layout/test.py index 696df6f6a22..e00c3a08d03 100644 --- a/go/ql/integration-tests/all-platforms/go/mixed-layout/test.py +++ b/go/ql/integration-tests/all-platforms/go/mixed-layout/test.py @@ -1,3 +1,2 @@ -from go_integration_test import * - -go_integration_test() +def test(codeql, go): + codeql.database.create(source_root="src") diff --git a/go/ql/integration-tests/all-platforms/go/ninja-sample/force_sequential_test_execution b/go/ql/integration-tests/all-platforms/go/ninja-sample/force_sequential_test_execution deleted file mode 100644 index b3655f44f96..00000000000 --- a/go/ql/integration-tests/all-platforms/go/ninja-sample/force_sequential_test_execution +++ /dev/null @@ -1,2 +0,0 @@ -# go get has been observed to sometimes fail when multiple tests try to simultaneously fetch the same package. -goget \ No newline at end of file diff --git a/go/ql/integration-tests/all-platforms/go/ninja-sample/test.py b/go/ql/integration-tests/all-platforms/go/ninja-sample/test.py index 696df6f6a22..e00c3a08d03 100644 --- a/go/ql/integration-tests/all-platforms/go/ninja-sample/test.py +++ b/go/ql/integration-tests/all-platforms/go/ninja-sample/test.py @@ -1,3 +1,2 @@ -from go_integration_test import * - -go_integration_test() +def test(codeql, go): + codeql.database.create(source_root="src") diff --git a/go/ql/integration-tests/all-platforms/go/qlpack.yml b/go/ql/integration-tests/all-platforms/go/qlpack.yml deleted file mode 100644 index 2fc2dd566dd..00000000000 --- a/go/ql/integration-tests/all-platforms/go/qlpack.yml +++ /dev/null @@ -1,5 +0,0 @@ -dependencies: - codeql/go-all: '*' - codeql/go-tests: '*' - codeql/go-queries: '*' -warnOnImplicitThis: true diff --git a/go/ql/integration-tests/all-platforms/go/resolve-build-environment/newer-go-needed/test.py b/go/ql/integration-tests/all-platforms/go/resolve-build-environment/newer-go-needed/test.py index 87741c37088..28f47b5f071 100644 --- a/go/ql/integration-tests/all-platforms/go/resolve-build-environment/newer-go-needed/test.py +++ b/go/ql/integration-tests/all-platforms/go/resolve-build-environment/newer-go-needed/test.py @@ -1,3 +1,6 @@ -from go_integration_test import * +import pytest -go_integration_test(toolchain="go1.21.0") + +@pytest.mark.resolve_build_environment(env={"GOTOOLCHAIN": "go1.21.0"}) +def test(codeql, go): + codeql.database.create(source_root="src") diff --git a/go/ql/integration-tests/all-platforms/go/single-go-mod-and-go-files-not-under-it/force_sequential_test_execution b/go/ql/integration-tests/all-platforms/go/single-go-mod-and-go-files-not-under-it/force_sequential_test_execution deleted file mode 100644 index b3655f44f96..00000000000 --- a/go/ql/integration-tests/all-platforms/go/single-go-mod-and-go-files-not-under-it/force_sequential_test_execution +++ /dev/null @@ -1,2 +0,0 @@ -# go get has been observed to sometimes fail when multiple tests try to simultaneously fetch the same package. -goget \ No newline at end of file diff --git a/go/ql/integration-tests/all-platforms/go/single-go-mod-and-go-files-not-under-it/test.py b/go/ql/integration-tests/all-platforms/go/single-go-mod-and-go-files-not-under-it/test.py index 696df6f6a22..e00c3a08d03 100644 --- a/go/ql/integration-tests/all-platforms/go/single-go-mod-and-go-files-not-under-it/test.py +++ b/go/ql/integration-tests/all-platforms/go/single-go-mod-and-go-files-not-under-it/test.py @@ -1,3 +1,2 @@ -from go_integration_test import * - -go_integration_test() +def test(codeql, go): + codeql.database.create(source_root="src") diff --git a/go/ql/integration-tests/all-platforms/go/single-go-mod-in-root/force_sequential_test_execution b/go/ql/integration-tests/all-platforms/go/single-go-mod-in-root/force_sequential_test_execution deleted file mode 100644 index b3655f44f96..00000000000 --- a/go/ql/integration-tests/all-platforms/go/single-go-mod-in-root/force_sequential_test_execution +++ /dev/null @@ -1,2 +0,0 @@ -# go get has been observed to sometimes fail when multiple tests try to simultaneously fetch the same package. -goget \ No newline at end of file diff --git a/go/ql/integration-tests/all-platforms/go/single-go-mod-in-root/test.py b/go/ql/integration-tests/all-platforms/go/single-go-mod-in-root/test.py index 696df6f6a22..e00c3a08d03 100644 --- a/go/ql/integration-tests/all-platforms/go/single-go-mod-in-root/test.py +++ b/go/ql/integration-tests/all-platforms/go/single-go-mod-in-root/test.py @@ -1,3 +1,2 @@ -from go_integration_test import * - -go_integration_test() +def test(codeql, go): + codeql.database.create(source_root="src") diff --git a/go/ql/integration-tests/all-platforms/go/single-go-mod-not-in-root/force_sequential_test_execution b/go/ql/integration-tests/all-platforms/go/single-go-mod-not-in-root/force_sequential_test_execution deleted file mode 100644 index b3655f44f96..00000000000 --- a/go/ql/integration-tests/all-platforms/go/single-go-mod-not-in-root/force_sequential_test_execution +++ /dev/null @@ -1,2 +0,0 @@ -# go get has been observed to sometimes fail when multiple tests try to simultaneously fetch the same package. -goget \ No newline at end of file diff --git a/go/ql/integration-tests/all-platforms/go/single-go-mod-not-in-root/test.py b/go/ql/integration-tests/all-platforms/go/single-go-mod-not-in-root/test.py index 696df6f6a22..e00c3a08d03 100644 --- a/go/ql/integration-tests/all-platforms/go/single-go-mod-not-in-root/test.py +++ b/go/ql/integration-tests/all-platforms/go/single-go-mod-not-in-root/test.py @@ -1,3 +1,2 @@ -from go_integration_test import * - -go_integration_test() +def test(codeql, go): + codeql.database.create(source_root="src") diff --git a/go/ql/integration-tests/all-platforms/go/single-go-work-not-in-root/force_sequential_test_execution b/go/ql/integration-tests/all-platforms/go/single-go-work-not-in-root/force_sequential_test_execution deleted file mode 100644 index b3655f44f96..00000000000 --- a/go/ql/integration-tests/all-platforms/go/single-go-work-not-in-root/force_sequential_test_execution +++ /dev/null @@ -1,2 +0,0 @@ -# go get has been observed to sometimes fail when multiple tests try to simultaneously fetch the same package. -goget \ No newline at end of file diff --git a/go/ql/integration-tests/all-platforms/go/single-go-work-not-in-root/test.py b/go/ql/integration-tests/all-platforms/go/single-go-work-not-in-root/test.py index 696df6f6a22..e00c3a08d03 100644 --- a/go/ql/integration-tests/all-platforms/go/single-go-work-not-in-root/test.py +++ b/go/ql/integration-tests/all-platforms/go/single-go-work-not-in-root/test.py @@ -1,3 +1,2 @@ -from go_integration_test import * - -go_integration_test() +def test(codeql, go): + codeql.database.create(source_root="src") diff --git a/go/ql/integration-tests/all-platforms/go/two-go-mods-nested-none-in-root/force_sequential_test_execution b/go/ql/integration-tests/all-platforms/go/two-go-mods-nested-none-in-root/force_sequential_test_execution deleted file mode 100644 index b3655f44f96..00000000000 --- a/go/ql/integration-tests/all-platforms/go/two-go-mods-nested-none-in-root/force_sequential_test_execution +++ /dev/null @@ -1,2 +0,0 @@ -# go get has been observed to sometimes fail when multiple tests try to simultaneously fetch the same package. -goget \ No newline at end of file diff --git a/go/ql/integration-tests/all-platforms/go/two-go-mods-nested-none-in-root/test.py b/go/ql/integration-tests/all-platforms/go/two-go-mods-nested-none-in-root/test.py index 696df6f6a22..e00c3a08d03 100644 --- a/go/ql/integration-tests/all-platforms/go/two-go-mods-nested-none-in-root/test.py +++ b/go/ql/integration-tests/all-platforms/go/two-go-mods-nested-none-in-root/test.py @@ -1,3 +1,2 @@ -from go_integration_test import * - -go_integration_test() +def test(codeql, go): + codeql.database.create(source_root="src") diff --git a/go/ql/integration-tests/all-platforms/go/two-go-mods-nested-one-in-root/force_sequential_test_execution b/go/ql/integration-tests/all-platforms/go/two-go-mods-nested-one-in-root/force_sequential_test_execution deleted file mode 100644 index b3655f44f96..00000000000 --- a/go/ql/integration-tests/all-platforms/go/two-go-mods-nested-one-in-root/force_sequential_test_execution +++ /dev/null @@ -1,2 +0,0 @@ -# go get has been observed to sometimes fail when multiple tests try to simultaneously fetch the same package. -goget \ No newline at end of file diff --git a/go/ql/integration-tests/all-platforms/go/two-go-mods-nested-one-in-root/test.py b/go/ql/integration-tests/all-platforms/go/two-go-mods-nested-one-in-root/test.py index 696df6f6a22..e00c3a08d03 100644 --- a/go/ql/integration-tests/all-platforms/go/two-go-mods-nested-one-in-root/test.py +++ b/go/ql/integration-tests/all-platforms/go/two-go-mods-nested-one-in-root/test.py @@ -1,3 +1,2 @@ -from go_integration_test import * - -go_integration_test() +def test(codeql, go): + codeql.database.create(source_root="src") diff --git a/go/ql/integration-tests/all-platforms/go/two-go-mods-not-nested/force_sequential_test_execution b/go/ql/integration-tests/all-platforms/go/two-go-mods-not-nested/force_sequential_test_execution deleted file mode 100644 index b3655f44f96..00000000000 --- a/go/ql/integration-tests/all-platforms/go/two-go-mods-not-nested/force_sequential_test_execution +++ /dev/null @@ -1,2 +0,0 @@ -# go get has been observed to sometimes fail when multiple tests try to simultaneously fetch the same package. -goget \ No newline at end of file diff --git a/go/ql/integration-tests/all-platforms/go/two-go-mods-not-nested/test.py b/go/ql/integration-tests/all-platforms/go/two-go-mods-not-nested/test.py index 696df6f6a22..e00c3a08d03 100644 --- a/go/ql/integration-tests/all-platforms/go/two-go-mods-not-nested/test.py +++ b/go/ql/integration-tests/all-platforms/go/two-go-mods-not-nested/test.py @@ -1,3 +1,2 @@ -from go_integration_test import * - -go_integration_test() +def test(codeql, go): + codeql.database.create(source_root="src") diff --git a/go/ql/integration-tests/all-platforms/go/two-go-mods-one-failure/force_sequential_test_execution b/go/ql/integration-tests/all-platforms/go/two-go-mods-one-failure/force_sequential_test_execution deleted file mode 100644 index 47ca9929099..00000000000 --- a/go/ql/integration-tests/all-platforms/go/two-go-mods-one-failure/force_sequential_test_execution +++ /dev/null @@ -1,2 +0,0 @@ -# go get has been observed to sometimes fail when multiple tests try to simultaneously fetch the same package. -goget diff --git a/go/ql/integration-tests/all-platforms/go/two-go-mods-one-failure/test.py b/go/ql/integration-tests/all-platforms/go/two-go-mods-one-failure/test.py index 696df6f6a22..e00c3a08d03 100644 --- a/go/ql/integration-tests/all-platforms/go/two-go-mods-one-failure/test.py +++ b/go/ql/integration-tests/all-platforms/go/two-go-mods-one-failure/test.py @@ -1,3 +1,2 @@ -from go_integration_test import * - -go_integration_test() +def test(codeql, go): + codeql.database.create(source_root="src") diff --git a/go/ql/integration-tests/legacy b/go/ql/integration-tests/legacy deleted file mode 100644 index 52478f0a7ef..00000000000 --- a/go/ql/integration-tests/legacy +++ /dev/null @@ -1 +0,0 @@ -These tests are still run with the legacy test runner diff --git a/go/ql/integration-tests/linux-only/go/dep-sample/force_sequential_test_execution b/go/ql/integration-tests/linux-only/go/dep-sample/force_sequential_test_execution deleted file mode 100644 index b3655f44f96..00000000000 --- a/go/ql/integration-tests/linux-only/go/dep-sample/force_sequential_test_execution +++ /dev/null @@ -1,2 +0,0 @@ -# go get has been observed to sometimes fail when multiple tests try to simultaneously fetch the same package. -goget \ No newline at end of file diff --git a/go/ql/integration-tests/linux-only/go/dep-sample/test.py b/go/ql/integration-tests/linux-only/go/dep-sample/test.py index f87a97e7a5a..4b4d8da7ca1 100644 --- a/go/ql/integration-tests/linux-only/go/dep-sample/test.py +++ b/go/ql/integration-tests/linux-only/go/dep-sample/test.py @@ -1,6 +1,10 @@ import os +import runs_on +import pytest -from go_integration_test import * -os.environ['LGTM_INDEX_IMPORT_PATH'] = "deptest" -go_integration_test(source="work") +@pytest.mark.resolve_build_environment(source_root="work") +@runs_on.linux +def test(codeql, go): + os.environ["LGTM_INDEX_IMPORT_PATH"] = "deptest" + codeql.database.create(source_root="work") diff --git a/go/ql/integration-tests/linux-only/go/glide-sample/test.py b/go/ql/integration-tests/linux-only/go/glide-sample/test.py index 89638a056a3..bd376d76c5e 100644 --- a/go/ql/integration-tests/linux-only/go/glide-sample/test.py +++ b/go/ql/integration-tests/linux-only/go/glide-sample/test.py @@ -1,6 +1,10 @@ import os +import runs_on +import pytest -from go_integration_test import * -os.environ['LGTM_INDEX_IMPORT_PATH'] = "glidetest" -go_integration_test(source="work") +@pytest.mark.resolve_build_environment(source_root="work") +@runs_on.linux +def test(codeql, go): + os.environ["LGTM_INDEX_IMPORT_PATH"] = "glidetest" + codeql.database.create(source_root="work") diff --git a/go/ql/integration-tests/linux-only/go/qlpack.yml b/go/ql/integration-tests/linux-only/go/qlpack.yml deleted file mode 100644 index 2fc2dd566dd..00000000000 --- a/go/ql/integration-tests/linux-only/go/qlpack.yml +++ /dev/null @@ -1,5 +0,0 @@ -dependencies: - codeql/go-all: '*' - codeql/go-tests: '*' - codeql/go-queries: '*' -warnOnImplicitThis: true From 6cb6aeffbbd74bef27de71fa3da5526ea489f299 Mon Sep 17 00:00:00 2001 From: Cornelius Riemenschneider Date: Mon, 5 Aug 2024 13:30:23 +0200 Subject: [PATCH 2/7] Rename build-environment.expected to build_environment.expected. This follows the convention of our other expected files. --- .../{build-environment.expected => build_environment.expected} | 0 .../{build-environment.expected => build_environment.expected} | 0 .../{build-environment.expected => build_environment.expected} | 0 .../{build-environment.expected => build_environment.expected} | 0 .../{build-environment.expected => build_environment.expected} | 0 .../{build-environment.expected => build_environment.expected} | 0 .../{build-environment.expected => build_environment.expected} | 0 .../{build-environment.expected => build_environment.expected} | 0 .../{build-environment.expected => build_environment.expected} | 0 .../{build-environment.expected => build_environment.expected} | 0 .../{build-environment.expected => build_environment.expected} | 0 .../{build-environment.expected => build_environment.expected} | 0 .../{build-environment.expected => build_environment.expected} | 0 .../{build-environment.expected => build_environment.expected} | 0 .../{build-environment.expected => build_environment.expected} | 0 .../{build-environment.expected => build_environment.expected} | 0 .../{build-environment.expected => build_environment.expected} | 0 .../{build-environment.expected => build_environment.expected} | 0 .../{build-environment.expected => build_environment.expected} | 0 .../{build-environment.expected => build_environment.expected} | 0 .../{build-environment.expected => build_environment.expected} | 0 .../{build-environment.expected => build_environment.expected} | 0 .../{build-environment.expected => build_environment.expected} | 0 .../{build-environment.expected => build_environment.expected} | 0 .../{build-environment.expected => build_environment.expected} | 0 .../{build-environment.expected => build_environment.expected} | 0 .../{build-environment.expected => build_environment.expected} | 0 .../{build-environment.expected => build_environment.expected} | 0 .../{build-environment.expected => build_environment.expected} | 0 29 files changed, 0 insertions(+), 0 deletions(-) rename go/ql/integration-tests/all-platforms/go/bazel-sample-1/{build-environment.expected => build_environment.expected} (100%) rename go/ql/integration-tests/all-platforms/go/bazel-sample-2/{build-environment.expected => build_environment.expected} (100%) rename go/ql/integration-tests/all-platforms/go/diagnostics/build-constraints-exclude-all-go-files/{build-environment.expected => build_environment.expected} (100%) rename go/ql/integration-tests/all-platforms/go/diagnostics/go-files-found-not-processed/{build-environment.expected => build_environment.expected} (100%) rename go/ql/integration-tests/all-platforms/go/diagnostics/invalid-toolchain-version/{build-environment.expected => build_environment.expected} (100%) rename go/ql/integration-tests/all-platforms/go/diagnostics/newer-go-version-needed/{build-environment.expected => build_environment.expected} (100%) rename go/ql/integration-tests/all-platforms/go/diagnostics/no-go-files-found/{build-environment.expected => build_environment.expected} (100%) rename go/ql/integration-tests/all-platforms/go/diagnostics/package-not-found-with-go-mod/{build-environment.expected => build_environment.expected} (100%) rename go/ql/integration-tests/all-platforms/go/diagnostics/package-not-found-without-go-mod/{build-environment.expected => build_environment.expected} (100%) rename go/ql/integration-tests/all-platforms/go/diagnostics/unsupported-relative-path/{build-environment.expected => build_environment.expected} (100%) rename go/ql/integration-tests/all-platforms/go/extract-vendor/{build-environment.expected => build_environment.expected} (100%) rename go/ql/integration-tests/all-platforms/go/go-get-without-modules-sample/{build-environment.expected => build_environment.expected} (100%) rename go/ql/integration-tests/all-platforms/go/go-mod-sample/{build-environment.expected => build_environment.expected} (100%) rename go/ql/integration-tests/all-platforms/go/go-mod-without-version/{build-environment.expected => build_environment.expected} (100%) rename go/ql/integration-tests/all-platforms/go/go-version-bump/{build-environment.expected => build_environment.expected} (100%) rename go/ql/integration-tests/all-platforms/go/make-sample/{build-environment.expected => build_environment.expected} (100%) rename go/ql/integration-tests/all-platforms/go/mixed-layout/{build-environment.expected => build_environment.expected} (100%) rename go/ql/integration-tests/all-platforms/go/ninja-sample/{build-environment.expected => build_environment.expected} (100%) rename go/ql/integration-tests/all-platforms/go/resolve-build-environment/newer-go-needed/{build-environment.expected => build_environment.expected} (100%) rename go/ql/integration-tests/all-platforms/go/single-go-mod-and-go-files-not-under-it/{build-environment.expected => build_environment.expected} (100%) rename go/ql/integration-tests/all-platforms/go/single-go-mod-in-root/{build-environment.expected => build_environment.expected} (100%) rename go/ql/integration-tests/all-platforms/go/single-go-mod-not-in-root/{build-environment.expected => build_environment.expected} (100%) rename go/ql/integration-tests/all-platforms/go/single-go-work-not-in-root/{build-environment.expected => build_environment.expected} (100%) rename go/ql/integration-tests/all-platforms/go/two-go-mods-nested-none-in-root/{build-environment.expected => build_environment.expected} (100%) rename go/ql/integration-tests/all-platforms/go/two-go-mods-nested-one-in-root/{build-environment.expected => build_environment.expected} (100%) rename go/ql/integration-tests/all-platforms/go/two-go-mods-not-nested/{build-environment.expected => build_environment.expected} (100%) rename go/ql/integration-tests/all-platforms/go/two-go-mods-one-failure/{build-environment.expected => build_environment.expected} (100%) rename go/ql/integration-tests/linux-only/go/dep-sample/{build-environment.expected => build_environment.expected} (100%) rename go/ql/integration-tests/linux-only/go/glide-sample/{build-environment.expected => build_environment.expected} (100%) diff --git a/go/ql/integration-tests/all-platforms/go/bazel-sample-1/build-environment.expected b/go/ql/integration-tests/all-platforms/go/bazel-sample-1/build_environment.expected similarity index 100% rename from go/ql/integration-tests/all-platforms/go/bazel-sample-1/build-environment.expected rename to go/ql/integration-tests/all-platforms/go/bazel-sample-1/build_environment.expected diff --git a/go/ql/integration-tests/all-platforms/go/bazel-sample-2/build-environment.expected b/go/ql/integration-tests/all-platforms/go/bazel-sample-2/build_environment.expected similarity index 100% rename from go/ql/integration-tests/all-platforms/go/bazel-sample-2/build-environment.expected rename to go/ql/integration-tests/all-platforms/go/bazel-sample-2/build_environment.expected diff --git a/go/ql/integration-tests/all-platforms/go/diagnostics/build-constraints-exclude-all-go-files/build-environment.expected b/go/ql/integration-tests/all-platforms/go/diagnostics/build-constraints-exclude-all-go-files/build_environment.expected similarity index 100% rename from go/ql/integration-tests/all-platforms/go/diagnostics/build-constraints-exclude-all-go-files/build-environment.expected rename to go/ql/integration-tests/all-platforms/go/diagnostics/build-constraints-exclude-all-go-files/build_environment.expected diff --git a/go/ql/integration-tests/all-platforms/go/diagnostics/go-files-found-not-processed/build-environment.expected b/go/ql/integration-tests/all-platforms/go/diagnostics/go-files-found-not-processed/build_environment.expected similarity index 100% rename from go/ql/integration-tests/all-platforms/go/diagnostics/go-files-found-not-processed/build-environment.expected rename to go/ql/integration-tests/all-platforms/go/diagnostics/go-files-found-not-processed/build_environment.expected diff --git a/go/ql/integration-tests/all-platforms/go/diagnostics/invalid-toolchain-version/build-environment.expected b/go/ql/integration-tests/all-platforms/go/diagnostics/invalid-toolchain-version/build_environment.expected similarity index 100% rename from go/ql/integration-tests/all-platforms/go/diagnostics/invalid-toolchain-version/build-environment.expected rename to go/ql/integration-tests/all-platforms/go/diagnostics/invalid-toolchain-version/build_environment.expected diff --git a/go/ql/integration-tests/all-platforms/go/diagnostics/newer-go-version-needed/build-environment.expected b/go/ql/integration-tests/all-platforms/go/diagnostics/newer-go-version-needed/build_environment.expected similarity index 100% rename from go/ql/integration-tests/all-platforms/go/diagnostics/newer-go-version-needed/build-environment.expected rename to go/ql/integration-tests/all-platforms/go/diagnostics/newer-go-version-needed/build_environment.expected diff --git a/go/ql/integration-tests/all-platforms/go/diagnostics/no-go-files-found/build-environment.expected b/go/ql/integration-tests/all-platforms/go/diagnostics/no-go-files-found/build_environment.expected similarity index 100% rename from go/ql/integration-tests/all-platforms/go/diagnostics/no-go-files-found/build-environment.expected rename to go/ql/integration-tests/all-platforms/go/diagnostics/no-go-files-found/build_environment.expected diff --git a/go/ql/integration-tests/all-platforms/go/diagnostics/package-not-found-with-go-mod/build-environment.expected b/go/ql/integration-tests/all-platforms/go/diagnostics/package-not-found-with-go-mod/build_environment.expected similarity index 100% rename from go/ql/integration-tests/all-platforms/go/diagnostics/package-not-found-with-go-mod/build-environment.expected rename to go/ql/integration-tests/all-platforms/go/diagnostics/package-not-found-with-go-mod/build_environment.expected diff --git a/go/ql/integration-tests/all-platforms/go/diagnostics/package-not-found-without-go-mod/build-environment.expected b/go/ql/integration-tests/all-platforms/go/diagnostics/package-not-found-without-go-mod/build_environment.expected similarity index 100% rename from go/ql/integration-tests/all-platforms/go/diagnostics/package-not-found-without-go-mod/build-environment.expected rename to go/ql/integration-tests/all-platforms/go/diagnostics/package-not-found-without-go-mod/build_environment.expected diff --git a/go/ql/integration-tests/all-platforms/go/diagnostics/unsupported-relative-path/build-environment.expected b/go/ql/integration-tests/all-platforms/go/diagnostics/unsupported-relative-path/build_environment.expected similarity index 100% rename from go/ql/integration-tests/all-platforms/go/diagnostics/unsupported-relative-path/build-environment.expected rename to go/ql/integration-tests/all-platforms/go/diagnostics/unsupported-relative-path/build_environment.expected diff --git a/go/ql/integration-tests/all-platforms/go/extract-vendor/build-environment.expected b/go/ql/integration-tests/all-platforms/go/extract-vendor/build_environment.expected similarity index 100% rename from go/ql/integration-tests/all-platforms/go/extract-vendor/build-environment.expected rename to go/ql/integration-tests/all-platforms/go/extract-vendor/build_environment.expected diff --git a/go/ql/integration-tests/all-platforms/go/go-get-without-modules-sample/build-environment.expected b/go/ql/integration-tests/all-platforms/go/go-get-without-modules-sample/build_environment.expected similarity index 100% rename from go/ql/integration-tests/all-platforms/go/go-get-without-modules-sample/build-environment.expected rename to go/ql/integration-tests/all-platforms/go/go-get-without-modules-sample/build_environment.expected diff --git a/go/ql/integration-tests/all-platforms/go/go-mod-sample/build-environment.expected b/go/ql/integration-tests/all-platforms/go/go-mod-sample/build_environment.expected similarity index 100% rename from go/ql/integration-tests/all-platforms/go/go-mod-sample/build-environment.expected rename to go/ql/integration-tests/all-platforms/go/go-mod-sample/build_environment.expected diff --git a/go/ql/integration-tests/all-platforms/go/go-mod-without-version/build-environment.expected b/go/ql/integration-tests/all-platforms/go/go-mod-without-version/build_environment.expected similarity index 100% rename from go/ql/integration-tests/all-platforms/go/go-mod-without-version/build-environment.expected rename to go/ql/integration-tests/all-platforms/go/go-mod-without-version/build_environment.expected diff --git a/go/ql/integration-tests/all-platforms/go/go-version-bump/build-environment.expected b/go/ql/integration-tests/all-platforms/go/go-version-bump/build_environment.expected similarity index 100% rename from go/ql/integration-tests/all-platforms/go/go-version-bump/build-environment.expected rename to go/ql/integration-tests/all-platforms/go/go-version-bump/build_environment.expected diff --git a/go/ql/integration-tests/all-platforms/go/make-sample/build-environment.expected b/go/ql/integration-tests/all-platforms/go/make-sample/build_environment.expected similarity index 100% rename from go/ql/integration-tests/all-platforms/go/make-sample/build-environment.expected rename to go/ql/integration-tests/all-platforms/go/make-sample/build_environment.expected diff --git a/go/ql/integration-tests/all-platforms/go/mixed-layout/build-environment.expected b/go/ql/integration-tests/all-platforms/go/mixed-layout/build_environment.expected similarity index 100% rename from go/ql/integration-tests/all-platforms/go/mixed-layout/build-environment.expected rename to go/ql/integration-tests/all-platforms/go/mixed-layout/build_environment.expected diff --git a/go/ql/integration-tests/all-platforms/go/ninja-sample/build-environment.expected b/go/ql/integration-tests/all-platforms/go/ninja-sample/build_environment.expected similarity index 100% rename from go/ql/integration-tests/all-platforms/go/ninja-sample/build-environment.expected rename to go/ql/integration-tests/all-platforms/go/ninja-sample/build_environment.expected diff --git a/go/ql/integration-tests/all-platforms/go/resolve-build-environment/newer-go-needed/build-environment.expected b/go/ql/integration-tests/all-platforms/go/resolve-build-environment/newer-go-needed/build_environment.expected similarity index 100% rename from go/ql/integration-tests/all-platforms/go/resolve-build-environment/newer-go-needed/build-environment.expected rename to go/ql/integration-tests/all-platforms/go/resolve-build-environment/newer-go-needed/build_environment.expected diff --git a/go/ql/integration-tests/all-platforms/go/single-go-mod-and-go-files-not-under-it/build-environment.expected b/go/ql/integration-tests/all-platforms/go/single-go-mod-and-go-files-not-under-it/build_environment.expected similarity index 100% rename from go/ql/integration-tests/all-platforms/go/single-go-mod-and-go-files-not-under-it/build-environment.expected rename to go/ql/integration-tests/all-platforms/go/single-go-mod-and-go-files-not-under-it/build_environment.expected diff --git a/go/ql/integration-tests/all-platforms/go/single-go-mod-in-root/build-environment.expected b/go/ql/integration-tests/all-platforms/go/single-go-mod-in-root/build_environment.expected similarity index 100% rename from go/ql/integration-tests/all-platforms/go/single-go-mod-in-root/build-environment.expected rename to go/ql/integration-tests/all-platforms/go/single-go-mod-in-root/build_environment.expected diff --git a/go/ql/integration-tests/all-platforms/go/single-go-mod-not-in-root/build-environment.expected b/go/ql/integration-tests/all-platforms/go/single-go-mod-not-in-root/build_environment.expected similarity index 100% rename from go/ql/integration-tests/all-platforms/go/single-go-mod-not-in-root/build-environment.expected rename to go/ql/integration-tests/all-platforms/go/single-go-mod-not-in-root/build_environment.expected diff --git a/go/ql/integration-tests/all-platforms/go/single-go-work-not-in-root/build-environment.expected b/go/ql/integration-tests/all-platforms/go/single-go-work-not-in-root/build_environment.expected similarity index 100% rename from go/ql/integration-tests/all-platforms/go/single-go-work-not-in-root/build-environment.expected rename to go/ql/integration-tests/all-platforms/go/single-go-work-not-in-root/build_environment.expected diff --git a/go/ql/integration-tests/all-platforms/go/two-go-mods-nested-none-in-root/build-environment.expected b/go/ql/integration-tests/all-platforms/go/two-go-mods-nested-none-in-root/build_environment.expected similarity index 100% rename from go/ql/integration-tests/all-platforms/go/two-go-mods-nested-none-in-root/build-environment.expected rename to go/ql/integration-tests/all-platforms/go/two-go-mods-nested-none-in-root/build_environment.expected diff --git a/go/ql/integration-tests/all-platforms/go/two-go-mods-nested-one-in-root/build-environment.expected b/go/ql/integration-tests/all-platforms/go/two-go-mods-nested-one-in-root/build_environment.expected similarity index 100% rename from go/ql/integration-tests/all-platforms/go/two-go-mods-nested-one-in-root/build-environment.expected rename to go/ql/integration-tests/all-platforms/go/two-go-mods-nested-one-in-root/build_environment.expected diff --git a/go/ql/integration-tests/all-platforms/go/two-go-mods-not-nested/build-environment.expected b/go/ql/integration-tests/all-platforms/go/two-go-mods-not-nested/build_environment.expected similarity index 100% rename from go/ql/integration-tests/all-platforms/go/two-go-mods-not-nested/build-environment.expected rename to go/ql/integration-tests/all-platforms/go/two-go-mods-not-nested/build_environment.expected diff --git a/go/ql/integration-tests/all-platforms/go/two-go-mods-one-failure/build-environment.expected b/go/ql/integration-tests/all-platforms/go/two-go-mods-one-failure/build_environment.expected similarity index 100% rename from go/ql/integration-tests/all-platforms/go/two-go-mods-one-failure/build-environment.expected rename to go/ql/integration-tests/all-platforms/go/two-go-mods-one-failure/build_environment.expected diff --git a/go/ql/integration-tests/linux-only/go/dep-sample/build-environment.expected b/go/ql/integration-tests/linux-only/go/dep-sample/build_environment.expected similarity index 100% rename from go/ql/integration-tests/linux-only/go/dep-sample/build-environment.expected rename to go/ql/integration-tests/linux-only/go/dep-sample/build_environment.expected diff --git a/go/ql/integration-tests/linux-only/go/glide-sample/build-environment.expected b/go/ql/integration-tests/linux-only/go/glide-sample/build_environment.expected similarity index 100% rename from go/ql/integration-tests/linux-only/go/glide-sample/build-environment.expected rename to go/ql/integration-tests/linux-only/go/glide-sample/build_environment.expected From 133a0914b546c051a0bff2621b63f0e355af008b Mon Sep 17 00:00:00 2001 From: Cornelius Riemenschneider Date: Mon, 5 Aug 2024 13:31:33 +0200 Subject: [PATCH 3/7] Delete old go integration test library. --- .../go_integration_test.py | 26 ------------------- 1 file changed, 26 deletions(-) delete mode 100644 go/integration-tests-lib/go_integration_test.py diff --git a/go/integration-tests-lib/go_integration_test.py b/go/integration-tests-lib/go_integration_test.py deleted file mode 100644 index 2c26f513ba1..00000000000 --- a/go/integration-tests-lib/go_integration_test.py +++ /dev/null @@ -1,26 +0,0 @@ -import os -from create_database_utils import * -from diagnostics_test_utils import * -from resolve_environment_utils import * - -def go_integration_test(toolchain=None, source = "src", db = "db", runFunction = runSuccessfully): - # Set up a GOPATH relative to this test's root directory; - # we set os.environ instead of using extra_env because we - # need it to be set for the call to "go clean -modcache" later - goPath = os.path.join(os.path.abspath(os.getcwd()), ".go") - os.environ['GOPATH'] = goPath - - extra_env = None - - if toolchain != None: - extra_env = { 'GOTOOLCHAIN': toolchain } - - try: - run_codeql_resolve_build_environment(lang="go", source=source, extra_env=extra_env) - run_codeql_database_create([], lang="go", source=source, db=db, runFunction=runFunction) - - check_diagnostics() - finally: - # Clean up the temporary GOPATH to prevent Bazel failures next - # time the tests are run; see https://github.com/golang/go/issues/27161 - subprocess.call(["go", "clean", "-modcache"]) From 46cf779062ef4eb2210ceb694fa981bfd4010229 Mon Sep 17 00:00:00 2001 From: Cornelius Riemenschneider Date: Tue, 6 Aug 2024 18:08:25 +0200 Subject: [PATCH 4/7] Address review. --- .../build-constraints-exclude-all-go-files/test.py | 4 ++-- .../go/diagnostics/go-files-found-not-processed/test.py | 5 ++--- .../go/diagnostics/newer-go-version-needed/test.py | 5 ++--- .../all-platforms/go/diagnostics/no-go-files-found/test.py | 5 ++--- .../go/diagnostics/package-not-found-with-go-mod/test.py | 5 ++--- .../diagnostics/package-not-found-without-go-mod/test.py | 5 ++--- .../go/diagnostics/unsupported-relative-path/test.py | 5 ++--- .../go/resolve-build-environment/newer-go-needed/test.py | 7 ++----- go/ql/integration-tests/linux-only/go/dep-sample/test.py | 5 ++--- go/ql/integration-tests/linux-only/go/glide-sample/test.py | 5 ++--- 10 files changed, 20 insertions(+), 31 deletions(-) diff --git a/go/ql/integration-tests/all-platforms/go/diagnostics/build-constraints-exclude-all-go-files/test.py b/go/ql/integration-tests/all-platforms/go/diagnostics/build-constraints-exclude-all-go-files/test.py index 4e875926cf7..66c393d1834 100644 --- a/go/ql/integration-tests/all-platforms/go/diagnostics/build-constraints-exclude-all-go-files/test.py +++ b/go/ql/integration-tests/all-platforms/go/diagnostics/build-constraints-exclude-all-go-files/test.py @@ -2,7 +2,7 @@ import os import pytest -@pytest.mark.resolve_build_environment(source_root="work") -def test(codeql, go): +def test(codeql, go, check_build_environment): + check_build_environment.source_root = "work" os.environ["LGTM_INDEX_IMPORT_PATH"] = "test" codeql.database.create(source_root="work") diff --git a/go/ql/integration-tests/all-platforms/go/diagnostics/go-files-found-not-processed/test.py b/go/ql/integration-tests/all-platforms/go/diagnostics/go-files-found-not-processed/test.py index 4e875926cf7..1800c6ddda8 100644 --- a/go/ql/integration-tests/all-platforms/go/diagnostics/go-files-found-not-processed/test.py +++ b/go/ql/integration-tests/all-platforms/go/diagnostics/go-files-found-not-processed/test.py @@ -1,8 +1,7 @@ import os -import pytest -@pytest.mark.resolve_build_environment(source_root="work") -def test(codeql, go): +def test(codeql, go, check_build_environment): + check_build_environment.source_root = "work" os.environ["LGTM_INDEX_IMPORT_PATH"] = "test" codeql.database.create(source_root="work") diff --git a/go/ql/integration-tests/all-platforms/go/diagnostics/newer-go-version-needed/test.py b/go/ql/integration-tests/all-platforms/go/diagnostics/newer-go-version-needed/test.py index 53ea788dad9..728ea2171cb 100644 --- a/go/ql/integration-tests/all-platforms/go/diagnostics/newer-go-version-needed/test.py +++ b/go/ql/integration-tests/all-platforms/go/diagnostics/newer-go-version-needed/test.py @@ -1,8 +1,7 @@ import os -import pytest -@pytest.mark.resolve_build_environment(source_root="work") -def test(codeql, go): +def test(codeql, go, check_build_environment): + check_build_environment.source_root = "work" os.environ["LGTM_INDEX_IMPORT_PATH"] = "test" codeql.database.create(source_root="work", _assert_failure=True) diff --git a/go/ql/integration-tests/all-platforms/go/diagnostics/no-go-files-found/test.py b/go/ql/integration-tests/all-platforms/go/diagnostics/no-go-files-found/test.py index 53ea788dad9..728ea2171cb 100644 --- a/go/ql/integration-tests/all-platforms/go/diagnostics/no-go-files-found/test.py +++ b/go/ql/integration-tests/all-platforms/go/diagnostics/no-go-files-found/test.py @@ -1,8 +1,7 @@ import os -import pytest -@pytest.mark.resolve_build_environment(source_root="work") -def test(codeql, go): +def test(codeql, go, check_build_environment): + check_build_environment.source_root = "work" os.environ["LGTM_INDEX_IMPORT_PATH"] = "test" codeql.database.create(source_root="work", _assert_failure=True) diff --git a/go/ql/integration-tests/all-platforms/go/diagnostics/package-not-found-with-go-mod/test.py b/go/ql/integration-tests/all-platforms/go/diagnostics/package-not-found-with-go-mod/test.py index 4e875926cf7..1800c6ddda8 100644 --- a/go/ql/integration-tests/all-platforms/go/diagnostics/package-not-found-with-go-mod/test.py +++ b/go/ql/integration-tests/all-platforms/go/diagnostics/package-not-found-with-go-mod/test.py @@ -1,8 +1,7 @@ import os -import pytest -@pytest.mark.resolve_build_environment(source_root="work") -def test(codeql, go): +def test(codeql, go, check_build_environment): + check_build_environment.source_root = "work" os.environ["LGTM_INDEX_IMPORT_PATH"] = "test" codeql.database.create(source_root="work") diff --git a/go/ql/integration-tests/all-platforms/go/diagnostics/package-not-found-without-go-mod/test.py b/go/ql/integration-tests/all-platforms/go/diagnostics/package-not-found-without-go-mod/test.py index 4e875926cf7..1800c6ddda8 100644 --- a/go/ql/integration-tests/all-platforms/go/diagnostics/package-not-found-without-go-mod/test.py +++ b/go/ql/integration-tests/all-platforms/go/diagnostics/package-not-found-without-go-mod/test.py @@ -1,8 +1,7 @@ import os -import pytest -@pytest.mark.resolve_build_environment(source_root="work") -def test(codeql, go): +def test(codeql, go, check_build_environment): + check_build_environment.source_root = "work" os.environ["LGTM_INDEX_IMPORT_PATH"] = "test" codeql.database.create(source_root="work") diff --git a/go/ql/integration-tests/all-platforms/go/diagnostics/unsupported-relative-path/test.py b/go/ql/integration-tests/all-platforms/go/diagnostics/unsupported-relative-path/test.py index c0a0f46fcca..6adaae10e3d 100644 --- a/go/ql/integration-tests/all-platforms/go/diagnostics/unsupported-relative-path/test.py +++ b/go/ql/integration-tests/all-platforms/go/diagnostics/unsupported-relative-path/test.py @@ -1,8 +1,7 @@ import os -import pytest -@pytest.mark.resolve_build_environment(source_root="work") -def test(codeql, go): +def test(codeql, go, check_build_environment): + check_build_environment.source_root = "work" os.environ["GITHUB_REPOSITORY"] = "a/b" codeql.database.create(source_root="work") diff --git a/go/ql/integration-tests/all-platforms/go/resolve-build-environment/newer-go-needed/test.py b/go/ql/integration-tests/all-platforms/go/resolve-build-environment/newer-go-needed/test.py index 28f47b5f071..00cb33e9eda 100644 --- a/go/ql/integration-tests/all-platforms/go/resolve-build-environment/newer-go-needed/test.py +++ b/go/ql/integration-tests/all-platforms/go/resolve-build-environment/newer-go-needed/test.py @@ -1,6 +1,3 @@ -import pytest - - -@pytest.mark.resolve_build_environment(env={"GOTOOLCHAIN": "go1.21.0"}) -def test(codeql, go): +def test(codeql, go, check_build_environment): + check_build_environment.env = {"GOTOOLCHAIN": "go1.21.0"} codeql.database.create(source_root="src") diff --git a/go/ql/integration-tests/linux-only/go/dep-sample/test.py b/go/ql/integration-tests/linux-only/go/dep-sample/test.py index 4b4d8da7ca1..8635c25153b 100644 --- a/go/ql/integration-tests/linux-only/go/dep-sample/test.py +++ b/go/ql/integration-tests/linux-only/go/dep-sample/test.py @@ -1,10 +1,9 @@ import os import runs_on -import pytest -@pytest.mark.resolve_build_environment(source_root="work") @runs_on.linux -def test(codeql, go): +def test(codeql, go, check_build_environment): + check_build_environment.source_root = "work" os.environ["LGTM_INDEX_IMPORT_PATH"] = "deptest" codeql.database.create(source_root="work") diff --git a/go/ql/integration-tests/linux-only/go/glide-sample/test.py b/go/ql/integration-tests/linux-only/go/glide-sample/test.py index bd376d76c5e..9e476ac3e67 100644 --- a/go/ql/integration-tests/linux-only/go/glide-sample/test.py +++ b/go/ql/integration-tests/linux-only/go/glide-sample/test.py @@ -1,10 +1,9 @@ import os import runs_on -import pytest -@pytest.mark.resolve_build_environment(source_root="work") @runs_on.linux -def test(codeql, go): +def test(codeql, go, check_build_environment): + check_build_environment.source_root = "work" os.environ["LGTM_INDEX_IMPORT_PATH"] = "glidetest" codeql.database.create(source_root="work") From 2310bd94a48e50f226308996ef063c23ec20645d Mon Sep 17 00:00:00 2001 From: Cornelius Riemenschneider Date: Thu, 8 Aug 2024 13:51:38 +0200 Subject: [PATCH 5/7] Simplify test. --- .../newer-go-needed/diagnostics.expected | 31 ------------------- .../newer-go-needed/test.py | 9 ++++-- 2 files changed, 6 insertions(+), 34 deletions(-) delete mode 100644 go/ql/integration-tests/all-platforms/go/resolve-build-environment/newer-go-needed/diagnostics.expected diff --git a/go/ql/integration-tests/all-platforms/go/resolve-build-environment/newer-go-needed/diagnostics.expected b/go/ql/integration-tests/all-platforms/go/resolve-build-environment/newer-go-needed/diagnostics.expected deleted file mode 100644 index b64c1397938..00000000000 --- a/go/ql/integration-tests/all-platforms/go/resolve-build-environment/newer-go-needed/diagnostics.expected +++ /dev/null @@ -1,31 +0,0 @@ -{ - "location": { - "file": "go.mod" - }, - "markdownMessage": "As of Go 1.21, toolchain versions [must use the 1.N.P syntax](https://go.dev/doc/toolchain#version).\n\n`1.22` in `go.mod` does not match this syntax and there is no additional `toolchain` directive, which may cause some `go` commands to fail.", - "severity": "warning", - "source": { - "extractorName": "go", - "id": "go/autobuilder/invalid-go-toolchain-version", - "name": "Invalid Go toolchain version" - }, - "visibility": { - "cliSummaryTable": true, - "statusPage": true, - "telemetry": true - } -} -{ - "markdownMessage": "A single `go.mod` file was found.\n\n`go.mod`", - "severity": "note", - "source": { - "extractorName": "go", - "id": "go/autobuilder/single-root-go-mod-found", - "name": "A single `go.mod` file was found in the root" - }, - "visibility": { - "cliSummaryTable": false, - "statusPage": false, - "telemetry": true - } -} diff --git a/go/ql/integration-tests/all-platforms/go/resolve-build-environment/newer-go-needed/test.py b/go/ql/integration-tests/all-platforms/go/resolve-build-environment/newer-go-needed/test.py index 00cb33e9eda..edbc32e1193 100644 --- a/go/ql/integration-tests/all-platforms/go/resolve-build-environment/newer-go-needed/test.py +++ b/go/ql/integration-tests/all-platforms/go/resolve-build-environment/newer-go-needed/test.py @@ -1,3 +1,6 @@ -def test(codeql, go, check_build_environment): - check_build_environment.env = {"GOTOOLCHAIN": "go1.21.0"} - codeql.database.create(source_root="src") +import os + + +def test(check_build_environment, go): + # the check for resolve build-environment runs after the test and will pick up this environment variable + os.environ["GOTOOLCHAIN"] = "go1.21.0" From ae96111848e9f99fdb57a3dfc10774371c1b2f49 Mon Sep 17 00:00:00 2001 From: Cornelius Riemenschneider Date: Fri, 9 Aug 2024 09:48:38 +0200 Subject: [PATCH 6/7] Revert "Simplify test." This reverts commit 2310bd94a48e50f226308996ef063c23ec20645d. --- .../newer-go-needed/diagnostics.expected | 31 +++++++++++++++++++ .../newer-go-needed/test.py | 9 ++---- 2 files changed, 34 insertions(+), 6 deletions(-) create mode 100644 go/ql/integration-tests/all-platforms/go/resolve-build-environment/newer-go-needed/diagnostics.expected diff --git a/go/ql/integration-tests/all-platforms/go/resolve-build-environment/newer-go-needed/diagnostics.expected b/go/ql/integration-tests/all-platforms/go/resolve-build-environment/newer-go-needed/diagnostics.expected new file mode 100644 index 00000000000..b64c1397938 --- /dev/null +++ b/go/ql/integration-tests/all-platforms/go/resolve-build-environment/newer-go-needed/diagnostics.expected @@ -0,0 +1,31 @@ +{ + "location": { + "file": "go.mod" + }, + "markdownMessage": "As of Go 1.21, toolchain versions [must use the 1.N.P syntax](https://go.dev/doc/toolchain#version).\n\n`1.22` in `go.mod` does not match this syntax and there is no additional `toolchain` directive, which may cause some `go` commands to fail.", + "severity": "warning", + "source": { + "extractorName": "go", + "id": "go/autobuilder/invalid-go-toolchain-version", + "name": "Invalid Go toolchain version" + }, + "visibility": { + "cliSummaryTable": true, + "statusPage": true, + "telemetry": true + } +} +{ + "markdownMessage": "A single `go.mod` file was found.\n\n`go.mod`", + "severity": "note", + "source": { + "extractorName": "go", + "id": "go/autobuilder/single-root-go-mod-found", + "name": "A single `go.mod` file was found in the root" + }, + "visibility": { + "cliSummaryTable": false, + "statusPage": false, + "telemetry": true + } +} diff --git a/go/ql/integration-tests/all-platforms/go/resolve-build-environment/newer-go-needed/test.py b/go/ql/integration-tests/all-platforms/go/resolve-build-environment/newer-go-needed/test.py index edbc32e1193..00cb33e9eda 100644 --- a/go/ql/integration-tests/all-platforms/go/resolve-build-environment/newer-go-needed/test.py +++ b/go/ql/integration-tests/all-platforms/go/resolve-build-environment/newer-go-needed/test.py @@ -1,6 +1,3 @@ -import os - - -def test(check_build_environment, go): - # the check for resolve build-environment runs after the test and will pick up this environment variable - os.environ["GOTOOLCHAIN"] = "go1.21.0" +def test(codeql, go, check_build_environment): + check_build_environment.env = {"GOTOOLCHAIN": "go1.21.0"} + codeql.database.create(source_root="src") From 00efebe8b0fb332d616d9f7f84a21fa8be07b0d1 Mon Sep 17 00:00:00 2001 From: Chris Smowton Date: Fri, 9 Aug 2024 12:32:43 +0100 Subject: [PATCH 7/7] Add test for buildless fetching an executable war file --- .../buildless-fetches.expected | 27 ++++ .../diagnostics.expected | 70 +++++++++ .../force_sequential_test_execution | 1 + .../buildless-maven-executable-war/pom.xml | 144 ++++++++++++++++++ .../src/main/java/com/example/App.java | 30 ++++ .../src/main/resources/my-app.properties | 1 + .../src/main/resources/page.xml | 8 + .../src/main/resources/struts.xml | 4 + .../src/test/java/com/example/AppTest.java | 20 +++ .../test.expected | 10 ++ .../buildless-maven-executable-war/test.py | 8 + .../buildless-maven-executable-war/test.ql | 9 ++ 12 files changed, 332 insertions(+) create mode 100644 java/ql/integration-tests/all-platforms/java/buildless-maven-executable-war/buildless-fetches.expected create mode 100644 java/ql/integration-tests/all-platforms/java/buildless-maven-executable-war/diagnostics.expected create mode 100644 java/ql/integration-tests/all-platforms/java/buildless-maven-executable-war/force_sequential_test_execution create mode 100644 java/ql/integration-tests/all-platforms/java/buildless-maven-executable-war/pom.xml create mode 100644 java/ql/integration-tests/all-platforms/java/buildless-maven-executable-war/src/main/java/com/example/App.java create mode 100644 java/ql/integration-tests/all-platforms/java/buildless-maven-executable-war/src/main/resources/my-app.properties create mode 100644 java/ql/integration-tests/all-platforms/java/buildless-maven-executable-war/src/main/resources/page.xml create mode 100644 java/ql/integration-tests/all-platforms/java/buildless-maven-executable-war/src/main/resources/struts.xml create mode 100644 java/ql/integration-tests/all-platforms/java/buildless-maven-executable-war/src/test/java/com/example/AppTest.java create mode 100644 java/ql/integration-tests/all-platforms/java/buildless-maven-executable-war/test.expected create mode 100644 java/ql/integration-tests/all-platforms/java/buildless-maven-executable-war/test.py create mode 100644 java/ql/integration-tests/all-platforms/java/buildless-maven-executable-war/test.ql diff --git a/java/ql/integration-tests/all-platforms/java/buildless-maven-executable-war/buildless-fetches.expected b/java/ql/integration-tests/all-platforms/java/buildless-maven-executable-war/buildless-fetches.expected new file mode 100644 index 00000000000..a956477896c --- /dev/null +++ b/java/ql/integration-tests/all-platforms/java/buildless-maven-executable-war/buildless-fetches.expected @@ -0,0 +1,27 @@ +https://repo.jenkins-ci.org/releases/org/jenkins-ci/main/jenkins-war/2.249/jenkins-war-2.249.war +https://repo.maven.apache.org/maven2/com/feiniaojin/naaf/naaf-graceful-response-example/1.0/naaf-graceful-response-example-1.0.jar +https://repo.maven.apache.org/maven2/com/github/MoebiusSolutions/avro-registry-in-source/avro-registry-in-source-tests/1.8/avro-registry-in-source-tests-1.8.jar +https://repo.maven.apache.org/maven2/com/github/MoebiusSolutions/avro-registry-in-source/example-project/1.5/example-project-1.5.jar +https://repo.maven.apache.org/maven2/com/intuit/benten/benten-examples/0.1.5/benten-examples-0.1.5.jar +https://repo.maven.apache.org/maven2/com/jakewharton/twirl/sample-runtime/1.2.0/sample-runtime-1.2.0.jar +https://repo.maven.apache.org/maven2/com/mattunderscore/code/generation/specky/plugin-example/0.8.0/plugin-example-0.8.0.jar +https://repo.maven.apache.org/maven2/com/microsoft/tang/tang-test-jarAB/0.9/tang-test-jarAB-0.9.jar +https://repo.maven.apache.org/maven2/de/knutwalker/rx-redis-example_2.11/0.1.2/rx-redis-example_2.11-0.1.2.jar +https://repo.maven.apache.org/maven2/de/knutwalker/rx-redis-java-example_2.11/0.1.2/rx-redis-java-example_2.11-0.1.2.jar +https://repo.maven.apache.org/maven2/io/github/scrollsyou/example-spring-boot-starter/1.0.0/example-spring-boot-starter-1.0.0.jar +https://repo.maven.apache.org/maven2/io/streamnative/com/example/maven-central-template/server/3.0.0/server-3.0.0.jar +https://repo.maven.apache.org/maven2/junit/junit/4.11/junit-4.11.jar +https://repo.maven.apache.org/maven2/no/nav/security/token-validation-ktor-demo/3.1.0/token-validation-ktor-demo-3.1.0.jar +https://repo.maven.apache.org/maven2/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar +https://repo.maven.apache.org/maven2/org/minijax/minijax-example-fileupload/0.5.10/minijax-example-fileupload-0.5.10.jar +https://repo.maven.apache.org/maven2/org/minijax/minijax-example-inject/0.5.10/minijax-example-inject-0.5.10.jar +https://repo.maven.apache.org/maven2/org/minijax/minijax-example-json/0.5.10/minijax-example-json-0.5.10.jar +https://repo.maven.apache.org/maven2/org/minijax/minijax-example-mustache/0.5.10/minijax-example-mustache-0.5.10.jar +https://repo.maven.apache.org/maven2/org/minijax/minijax-example-petclinic/0.5.10/minijax-example-petclinic-0.5.10.jar +https://repo.maven.apache.org/maven2/org/minijax/minijax-example-security/0.5.10/minijax-example-security-0.5.10.jar +https://repo.maven.apache.org/maven2/org/minijax/minijax-example-ssl/0.5.10/minijax-example-ssl-0.5.10.jar +https://repo.maven.apache.org/maven2/org/minijax/minijax-example-todo-backend/0.5.10/minijax-example-todo-backend-0.5.10.jar +https://repo.maven.apache.org/maven2/org/minijax/minijax-example-websocket/0.5.10/minijax-example-websocket-0.5.10.jar +https://repo.maven.apache.org/maven2/org/scalamock/scalamock-examples_2.10/3.6.0/scalamock-examples_2.10-3.6.0.jar +https://repo.maven.apache.org/maven2/org/somda/sdc/glue-examples/4.0.0/glue-examples-4.0.0.jar +https://repo.maven.apache.org/maven2/us/fatehi/schemacrawler-examplecode/16.20.2/schemacrawler-examplecode-16.20.2.jar diff --git a/java/ql/integration-tests/all-platforms/java/buildless-maven-executable-war/diagnostics.expected b/java/ql/integration-tests/all-platforms/java/buildless-maven-executable-war/diagnostics.expected new file mode 100644 index 00000000000..1058e1528f9 --- /dev/null +++ b/java/ql/integration-tests/all-platforms/java/buildless-maven-executable-war/diagnostics.expected @@ -0,0 +1,70 @@ +{ + "markdownMessage": "Java analysis used build tool Maven to pick a JDK version and/or to recommend external dependencies.", + "severity": "unknown", + "source": { + "extractorName": "java", + "id": "java/autobuilder/buildless/using-build-tool-advice", + "name": "Java analysis used build tool Maven to pick a JDK version and/or to recommend external dependencies" + }, + "visibility": { + "cliSummaryTable": true, + "statusPage": false, + "telemetry": true + } +} +{ + "markdownMessage": "Java analysis used the system default JDK.", + "severity": "unknown", + "source": { + "extractorName": "java", + "id": "java/autobuilder/buildless/jdk-system-default", + "name": "Java analysis used the system default JDK" + }, + "visibility": { + "cliSummaryTable": true, + "statusPage": false, + "telemetry": true + } +} +{ + "markdownMessage": "Java analysis with build-mode 'none' completed.", + "severity": "unknown", + "source": { + "extractorName": "java", + "id": "java/autobuilder/buildless/complete", + "name": "Java analysis with build-mode 'none' completed" + }, + "visibility": { + "cliSummaryTable": true, + "statusPage": false, + "telemetry": true + } +} +{ + "markdownMessage": "Java was extracted with build-mode set to 'none'. This means that all Java source in the working directory will be scanned, with build tools such as Maven and Gradle only contributing information about external dependencies.", + "severity": "note", + "source": { + "extractorName": "java", + "id": "java/autobuilder/buildless/mode-active", + "name": "Java was extracted with build-mode set to 'none'" + }, + "visibility": { + "cliSummaryTable": true, + "statusPage": true, + "telemetry": true + } +} +{ + "markdownMessage": "Reading the dependency graph from build files provided 3 classpath entries", + "severity": "unknown", + "source": { + "extractorName": "java", + "id": "java/autobuilder/buildless/depgraph-provided-by-maven", + "name": "Java analysis extracted precise dependency graph information from tool Maven" + }, + "visibility": { + "cliSummaryTable": true, + "statusPage": false, + "telemetry": true + } +} diff --git a/java/ql/integration-tests/all-platforms/java/buildless-maven-executable-war/force_sequential_test_execution b/java/ql/integration-tests/all-platforms/java/buildless-maven-executable-war/force_sequential_test_execution new file mode 100644 index 00000000000..dd90439bca5 --- /dev/null +++ b/java/ql/integration-tests/all-platforms/java/buildless-maven-executable-war/force_sequential_test_execution @@ -0,0 +1 @@ +# Concurrent Maven processes using ~/.m2/repository is not safe, so this test must run sequentially diff --git a/java/ql/integration-tests/all-platforms/java/buildless-maven-executable-war/pom.xml b/java/ql/integration-tests/all-platforms/java/buildless-maven-executable-war/pom.xml new file mode 100644 index 00000000000..c8edf00dc00 --- /dev/null +++ b/java/ql/integration-tests/all-platforms/java/buildless-maven-executable-war/pom.xml @@ -0,0 +1,144 @@ + + + + 4.0.0 + + com.example + maven-sample + 1.0-SNAPSHOT + + maven-sample + + http://www.example.com + + + UTF-8 + 1.7 + 1.7 + + + + + central + Maven Central + https://repo.maven.apache.org/maven2 + + false + + + + + maven.jenkins-ci.org + Jenkins Releases + https://repo.jenkins-ci.org/releases/ + + + + + + junit + junit + 4.11 + test + + + org.jenkins-ci.main + jenkins-war + 2.249 + executable-war + + + + * + * + + + + + + + + + exec-maven-plugin + org.codehaus.mojo + 1.1.1 + + + check-maven-version + package + + java + + + + + com.example.App + + + + com.diffplug.spotless + spotless-maven-plugin + 2.19.1 + + + + check + + compile + + + + + + /* FAIL ME */ + + + + + + + + + + + maven-clean-plugin + 3.1.0 + + + + maven-resources-plugin + 3.0.2 + + + maven-compiler-plugin + 3.8.0 + + + maven-surefire-plugin + 2.22.1 + + + maven-jar-plugin + 3.0.2 + + + maven-install-plugin + 2.5.2 + + + maven-deploy-plugin + 2.8.2 + + + + maven-site-plugin + 3.7.1 + + + maven-project-info-reports-plugin + 3.0.0 + + + + + diff --git a/java/ql/integration-tests/all-platforms/java/buildless-maven-executable-war/src/main/java/com/example/App.java b/java/ql/integration-tests/all-platforms/java/buildless-maven-executable-war/src/main/java/com/example/App.java new file mode 100644 index 00000000000..c9eec918587 --- /dev/null +++ b/java/ql/integration-tests/all-platforms/java/buildless-maven-executable-war/src/main/java/com/example/App.java @@ -0,0 +1,30 @@ +package com.example; + +import java.util.regex.Pattern; +import java.nio.file.Path; +import java.nio.file.Paths; + +/** + * Hello world! + * + */ +public class App +{ + public static void main( String[] args ) + { + System.out.println( "Hello World!" ); + String expectedVersion = System.getenv("EXPECT_MAVEN"); + Path mavenHome = Paths.get(System.getProperty("maven.home")).normalize(); + String observedVersion = mavenHome.getFileName().toString(); + if (expectedVersion != null && !expectedVersion.equals(observedVersion)) { + System.err.println("Wrong maven version, expected '" + expectedVersion + "' but got '" + observedVersion + "'" + mavenHome); + System.exit(1); + } + String commandMatcher = System.getenv("EXPECT_COMMAND_REGEX"); + String command = System.getProperty("sun.java.command"); + if (commandMatcher != null && !Pattern.matches(commandMatcher, command)) { + System.err.println("Wrong command line, '" + command + "' does not match '" + commandMatcher + "'"); + System.exit(1); + } + } +} diff --git a/java/ql/integration-tests/all-platforms/java/buildless-maven-executable-war/src/main/resources/my-app.properties b/java/ql/integration-tests/all-platforms/java/buildless-maven-executable-war/src/main/resources/my-app.properties new file mode 100644 index 00000000000..e566b49a29a --- /dev/null +++ b/java/ql/integration-tests/all-platforms/java/buildless-maven-executable-war/src/main/resources/my-app.properties @@ -0,0 +1 @@ +version=1.0 diff --git a/java/ql/integration-tests/all-platforms/java/buildless-maven-executable-war/src/main/resources/page.xml b/java/ql/integration-tests/all-platforms/java/buildless-maven-executable-war/src/main/resources/page.xml new file mode 100644 index 00000000000..2bab459cb03 --- /dev/null +++ b/java/ql/integration-tests/all-platforms/java/buildless-maven-executable-war/src/main/resources/page.xml @@ -0,0 +1,8 @@ + + +A sample + + +

Hello world!

+ + diff --git a/java/ql/integration-tests/all-platforms/java/buildless-maven-executable-war/src/main/resources/struts.xml b/java/ql/integration-tests/all-platforms/java/buildless-maven-executable-war/src/main/resources/struts.xml new file mode 100644 index 00000000000..73fc0c6b9cb --- /dev/null +++ b/java/ql/integration-tests/all-platforms/java/buildless-maven-executable-war/src/main/resources/struts.xml @@ -0,0 +1,4 @@ + + +This is a sample file + diff --git a/java/ql/integration-tests/all-platforms/java/buildless-maven-executable-war/src/test/java/com/example/AppTest.java b/java/ql/integration-tests/all-platforms/java/buildless-maven-executable-war/src/test/java/com/example/AppTest.java new file mode 100644 index 00000000000..22a94ca6f01 --- /dev/null +++ b/java/ql/integration-tests/all-platforms/java/buildless-maven-executable-war/src/test/java/com/example/AppTest.java @@ -0,0 +1,20 @@ +package com.example; + +import static org.junit.Assert.assertTrue; + +import org.junit.Test; + +/** + * Unit test for simple App. + */ +public class AppTest +{ + /** + * Rigorous Test :-) + */ + @Test + public void shouldAnswerWithTrue() + { + assertTrue( true ); + } +} diff --git a/java/ql/integration-tests/all-platforms/java/buildless-maven-executable-war/test.expected b/java/ql/integration-tests/all-platforms/java/buildless-maven-executable-war/test.expected new file mode 100644 index 00000000000..cbd09bcf554 --- /dev/null +++ b/java/ql/integration-tests/all-platforms/java/buildless-maven-executable-war/test.expected @@ -0,0 +1,10 @@ +#select +| src/main/java/com/example/App.java:0:0:0:0 | App | +| src/test/java/com/example/AppTest.java:0:0:0:0 | AppTest | +xmlFiles +| pom.xml:0:0:0:0 | pom.xml | +| src/main/resources/page.xml:0:0:0:0 | src/main/resources/page.xml | +| src/main/resources/struts.xml:0:0:0:0 | src/main/resources/struts.xml | +propertiesFiles +| src/main/resources/my-app.properties:0:0:0:0 | src/main/resources/my-app.properties | +| test-db/log/ext/javac.properties:0:0:0:0 | test-db/log/ext/javac.properties | diff --git a/java/ql/integration-tests/all-platforms/java/buildless-maven-executable-war/test.py b/java/ql/integration-tests/all-platforms/java/buildless-maven-executable-war/test.py new file mode 100644 index 00000000000..bfff65b2fc2 --- /dev/null +++ b/java/ql/integration-tests/all-platforms/java/buildless-maven-executable-war/test.py @@ -0,0 +1,8 @@ +from create_database_utils import * +from diagnostics_test_utils import * +from buildless_test_utils import * + +run_codeql_database_create([], lang="java", extra_env={"CODEQL_EXTRACTOR_JAVA_OPTION_BUILDLESS": "true", "CODEQL_EXTRACTOR_JAVA_OPTION_BUILDLESS_CLASSPATH_FROM_BUILD_FILES": "true"}) + +check_diagnostics() +check_buildless_fetches() diff --git a/java/ql/integration-tests/all-platforms/java/buildless-maven-executable-war/test.ql b/java/ql/integration-tests/all-platforms/java/buildless-maven-executable-war/test.ql new file mode 100644 index 00000000000..25cd26fdd14 --- /dev/null +++ b/java/ql/integration-tests/all-platforms/java/buildless-maven-executable-war/test.ql @@ -0,0 +1,9 @@ +import java + +from File f +where f.isSourceFile() +select f + +query predicate xmlFiles(XmlFile x) { any() } + +query predicate propertiesFiles(File f) { f.getExtension() = "properties" }