Skip to content

Commit 7698157

Browse files
Adding local itf plugin
Reusing other branch code working on local target Some stuff All working Some cleanup
1 parent 1bd00fa commit 7698157

45 files changed

Lines changed: 1594 additions & 686 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.bazelrc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,17 @@ build:stub --@score_baselibs//score/mw/log/flags:KRemote_Logging=False
3939
build:stub --@score_logging//score/mw/log/flags:KRemote_Logging=False
4040
build:stub --@score_baselibs//score/json:base_library=nlohmann
4141

42+
# Target configuration for running integration tests on localhost
43+
build:host --define config=host
44+
test:host --sandbox_writable_path=/opt/score
45+
4246
# Target configuration for CPU:x86-64|OS:Linux build (do not use it in case of system toolchains!)
4347
build:x86_64-linux --config=stub
4448
build:x86_64-linux --config=toolchain_common
4549
build:x86_64-linux --platforms=@score_bazel_platforms//:x86_64-linux-gcc_12.2.0-posix
4650
build:x86_64-linux --extra_toolchains=@score_gcc_x86_64_toolchain//:x86_64-linux-gcc_12.2.0-posix
4751
build:x86_64-linux --extra_toolchains=@score_toolchains_rust//toolchains/ferrocene:ferrocene_x86_64_unknown_linux_gnu
52+
build:x86_64-linux --define config=x86_64-linux
4853

4954
# TODO arm64-linux when rust support is there
5055

MODULE.bazel

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ module(
1919
bazel_dep(name = "rules_python", version = "1.8.3")
2020
bazel_dep(name = "rules_rust", version = "0.61.0")
2121
bazel_dep(name = "rules_cc", version = "0.2.16")
22+
bazel_dep(name = "rules_oci", version = "2.3.0")
2223
bazel_dep(name = "aspect_rules_lint", version = "2.0.0")
2324
bazel_dep(name = "buildifier_prebuilt", version = "8.2.0.2")
2425
bazel_dep(name = "platforms", version = "1.0.0")
@@ -132,6 +133,22 @@ pip.parse(
132133
)
133134
use_repo(pip, "pip_score_venv_test")
134135

136+
bazel_dep(name = "score_itf", version = "0.1.0", dev_dependency = True)
137+
138+
oci = use_extension("@rules_oci//oci:extensions.bzl", "oci", dev_dependency = True)
139+
oci.pull(
140+
name = "linux_runtime",
141+
image = "index.docker.io/library/debian",
142+
tag = "bookworm",
143+
platforms = ["linux/amd64"],
144+
)
145+
use_repo(oci, "linux_runtime")
146+
147+
local_path_override(
148+
module_name = "score_itf",
149+
path = "/home/kam1yok/score/itf",
150+
)
151+
135152
bazel_dep(name = "score_baselibs_rust", version = "0.1.0")
136153
bazel_dep(name = "score_baselibs", version = "0.2.4")
137154
bazel_dep(name = "score_logging", version = "0.1.0")

MODULE.bazel.lock

Lines changed: 150 additions & 367 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/BUILD

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,13 @@ config_setting(
3131
},
3232
)
3333

34+
config_setting(
35+
name = "host",
36+
define_values = {
37+
"config": "host",
38+
},
39+
)
40+
3441
config_setting(
3542
name = "thread_sanitizer_enabled",
3643
define_values = {"sanitize": "thread"},

tests/integration/BUILD

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# *******************************************************************************
1313
load("@pip_score_venv_test//:requirements.bzl", "all_requirements")
1414
load("@rules_python//python:pip.bzl", "compile_pip_requirements")
15-
load("@score_tooling//python_basics:defs.bzl", "score_py_pytest", "score_virtualenv")
15+
load("@score_tooling//python_basics:defs.bzl", "score_virtualenv")
1616

1717
# In order to update the requirements, change the `requirements.txt` file and run:
1818
# `bazel run //tests/integration:requirements.update`.
@@ -40,24 +40,3 @@ score_virtualenv(
4040
venv_name = ".python_tc_venv",
4141
)
4242

43-
cc_library(
44-
name = "test_helper",
45-
hdrs = ["test_helper.hpp"],
46-
visibility = ["//tests:__subpackages__"],
47-
deps = [
48-
"@googletest//:gtest_main",
49-
],
50-
)
51-
52-
py_library(
53-
name = "control_interface",
54-
srcs = ["control_interface.py"],
55-
visibility = ["//tests:__subpackages__"],
56-
)
57-
58-
py_library(
59-
name = "testing_utils",
60-
srcs = ["testing_utils.py"],
61-
visibility = ["//tests:__subpackages__"],
62-
deps = [":control_interface"],
63-
)

tests/integration/control_interface.py

Lines changed: 0 additions & 58 deletions
This file was deleted.

tests/integration/readme.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
11
# Local integration testing
22

3-
## Prerequisites
4-
- fakechroot must be installed to run these tests
5-
- `sudo apt install fakechroot`
6-
73
## Running the tests
84

95
To run all tests, simply run `bazel test //tests/integration/...`
106

117
## Running a single test
12-
You can run a single integration test locally using `bazel test //tests/integration/<test name>`
8+
You can run a single integration test locally using `bazel test //tests/integration/<test name>`

tests/integration/smoke/BUILD

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,10 @@
1010
#
1111
# SPDX-License-Identifier: Apache-2.0
1212
# *******************************************************************************
13-
load("@pip_score_venv_test//:requirements.bzl", "all_requirements")
14-
load("@score_tooling//:defs.bzl", "score_py_pytest")
13+
load("@score_itf//:defs.bzl", "py_itf_test")
1514
load("//config:flatbuffers_rules.bzl", "flatbuffer_json_to_bin")
15+
load("//tests/utils/bazel:integration.bzl", "integration_test")
16+
load("//tests/utils/bazel:package_test_binaries.bzl", "package_test_binaries")
1617

1718
flatbuffer_json_to_bin(
1819
name = "test_lm_cfg",
@@ -36,7 +37,7 @@ cc_binary(
3637
deps = [
3738
"//src/control_client_lib",
3839
"//src/launch_manager_daemon/lifecycle_client_lib:lifecycle_client",
39-
"//tests/integration:test_helper",
40+
"//tests/utils/test_helper",
4041
"@googletest//:gtest_main",
4142
],
4243
)
@@ -47,27 +48,27 @@ cc_binary(
4748
deps = [
4849
"//src/control_client_lib",
4950
"//src/launch_manager_daemon/lifecycle_client_lib:lifecycle_client",
50-
"//tests/integration:test_helper",
51+
"//tests/utils/test_helper",
5152
"@googletest//:gtest_main",
5253
],
5354
)
5455

55-
score_py_pytest(
56+
package_test_binaries(
57+
name = "smoke_binaries",
58+
test_name = "smoke",
59+
binaries = {
60+
"//src/launch_manager_daemon:launch_manager": "",
61+
":control_daemon_mock": "",
62+
":gtest_process": "",
63+
":test_lm_cfg": "etc",
64+
":test_hm_cfg": "etc",
65+
},
66+
)
67+
68+
integration_test(
5669
name = "smoke",
57-
srcs = [
58-
"smoke.py",
59-
],
60-
args = [
61-
],
62-
data = [
63-
":control_daemon_mock",
64-
":gtest_process",
65-
"//src/launch_manager_daemon:launch_manager",
66-
],
67-
tags = [
68-
"integration",
69-
],
70-
deps = all_requirements + [
71-
"//tests/integration:testing_utils",
72-
],
70+
srcs = ["smoke.py"],
71+
test_binaries = ":smoke_binaries",
72+
deps = ["//tests/utils/testing_utils"],
73+
tags = ["integration"],
7374
)

tests/integration/smoke/control_daemon_mock.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#include <score/lcm/lifecycle_client.h>
1919
#include <score/lcm/control_client.h>
2020
#include <score/lcm/identifier_hash.hpp>
21-
#include "tests/integration/test_helper.hpp"
21+
#include "tests/utils/test_helper/test_helper.hpp"
2222

2323
score::lcm::ControlClient client([](const score::lcm::ExecutionErrorEvent& event) {
2424
std::cerr << "Undefined state callback invoked for process group id: " << event.processGroup.data() << std::endl;

tests/integration/smoke/gtest_process.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#include <unistd.h>
1818

1919
#include <csignal>
20-
#include "tests/integration/test_helper.hpp"
20+
#include "tests/utils/test_helper/test_helper.hpp"
2121

2222
TEST(Smoke, Process) {
2323
// report kRunning

0 commit comments

Comments
 (0)