Skip to content

Commit

Permalink
Add test module which uses the rule
Browse files Browse the repository at this point in the history
Checks that the rule is usable, but doesn't necessary test that it's
checking the correct files.

Signed-off-by: James Wainwright <[email protected]>
  • Loading branch information
jwnrt committed Aug 23, 2024
1 parent 0e06406 commit d9b602a
Show file tree
Hide file tree
Showing 7 changed files with 54 additions and 0 deletions.
1 change: 1 addition & 0 deletions .bazelignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
tests
1 change: 1 addition & 0 deletions tests/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
MODULE.bazel.lock
16 changes: 16 additions & 0 deletions tests/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Copyright lowRISC contributors.
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
# SPDX-License-Identifier: Apache-2.0

load("@lowrisc_misc_linters//rules:rules.bzl", "licence_test")

licence_test(
name = "licence_check",
exclude_patterns = ["file_without_licence.txt"],
licence = """
Copyright lowRISC contributors.
Licensed under the Apache License, Version 2.0, see LICENSE for details.
SPDX-License-Identifier: Apache-2.0
""",
workspace = ":MODULE.bazel",
)
13 changes: 13 additions & 0 deletions tests/MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Copyright lowRISC contributors.
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
# SPDX-License-Identifier: Apache-2.0

module(name = "lowrisc_misc_linters_tests")

bazel_dep(name = "lowrisc_misc_linters")
local_path_override(module_name = "lowrisc_misc_linters", path = "../")

bazel_dep(name = "rules_python", version = "0.34.0")
python = use_extension("@rules_python//python/extensions:python.bzl", "python")
python.toolchain(python_version = "3.9")

17 changes: 17 additions & 0 deletions tests/WORKSPACE
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Copyright lowRISC contributors.
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
# SPDX-License-Identifier: Apache-2.0

local_repository(
name = "lowrisc_misc_linters",
path = "..",
)

load("@lowrisc_misc_linters//rules:repos.bzl", "lowrisc_misc_linters_repos")
lowrisc_misc_linters_repos()
load("@lowrisc_misc_linters//rules:deps.bzl", "lowrisc_misc_linters_dependencies")
lowrisc_misc_linters_dependencies()
load("@lowrisc_misc_linters//rules:pip.bzl", "lowrisc_misc_linters_pip_dependencies")
lowrisc_misc_linters_pip_dependencies()
load("@lowrisc_misc_linters_pip//:requirements.bzl", "install_deps")
install_deps()
5 changes: 5 additions & 0 deletions tests/file_with_licence.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Copyright lowRISC contributors.
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
# SPDX-License-Identifier: Apache-2.0

This file has a licence!
1 change: 1 addition & 0 deletions tests/file_without_licence.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This file intentionally has no licence.

0 comments on commit d9b602a

Please sign in to comment.