fm-weck 1.4.8__py3-none-any.whl → 1.5.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
fm_weck/serve.py CHANGED
@@ -21,7 +21,7 @@ from fm_weck.run_result import RunResult
21
21
  from fm_weck.tmp_file import NTempFile
22
22
 
23
23
  from .config import Config, parse_fm_data
24
- from .engine import CACHE_MOUNT_LOCATION, Engine
24
+ from .engine import Engine
25
25
  from .file_util import copy_ensuring_unix_line_endings
26
26
 
27
27
  logger = logging.getLogger(__name__)
@@ -190,10 +190,10 @@ def run_guided(
190
190
  engine = Engine.from_config(fm_data, configuration)
191
191
 
192
192
  if log_output_to is not None:
193
- engine.set_output_log(log_output_to)
193
+ engine.set_log_file(log_output_to)
194
194
 
195
195
  if output_files_to is not None:
196
- engine.set_output_files_dir(output_files_to)
196
+ engine.set_output_dir(output_files_to)
197
197
  engine.print_output_to_stdout = print_tool_output_to_console
198
198
 
199
199
  current_dir = Path.cwd().resolve()
@@ -220,11 +220,9 @@ def run_guided(
220
220
 
221
221
  logger.debug("Assembled command from fm-tools: %s", command)
222
222
 
223
- execution_result = engine.run(
224
- f"{CACHE_MOUNT_LOCATION}/.scripts/run_with_overlay.sh", shelve_space.name, *command, timeout_sec=timeout_sec
225
- )
223
+ engine.use_overlay(shelve_space.name)
226
224
 
227
- return execution_result
225
+ return engine.run(*command, timeout_sec=timeout_sec)
228
226
 
229
227
 
230
228
  def run_manual(
@@ -233,6 +231,7 @@ def run_manual(
233
231
  configuration: Config,
234
232
  command: list[str],
235
233
  offline_mode: bool = False,
234
+ use_overlay: bool = False,
236
235
  log_output_to: Optional[Path] = None,
237
236
  output_files_to: Optional[Path] = None,
238
237
  timeout_sec: Optional[float] = None,
@@ -242,20 +241,28 @@ def run_manual(
242
241
  engine = Engine.from_config(fm_data, configuration)
243
242
 
244
243
  if log_output_to is not None:
245
- engine.set_output_log(log_output_to)
244
+ engine.set_log_file(log_output_to)
246
245
 
247
246
  if output_files_to is not None:
248
- engine.set_output_files_dir(output_files_to)
247
+ engine.set_output_dir(output_files_to)
249
248
 
250
- executable = fm_data.get_executable_path(shelve_space)
251
- logger.debug("Using executable %s", executable)
252
- logger.debug("Assembled command %s", [executable, *command])
249
+ if use_overlay:
250
+ configuration.make_script_available()
251
+ current_dir = Path.cwd().resolve()
252
+ os.chdir(shelve_space)
253
+ executable = fm_data.get_executable_path(Path("."))
254
+ os.chdir(current_dir)
255
+
256
+ logger.debug("Running with overlay...")
257
+ engine.use_overlay(shelve_space.name)
258
+ else:
259
+ executable = fm_data.get_executable_path(shelve_space)
253
260
 
254
261
  if log_output_to is not None:
255
- engine.set_output_log(log_output_to)
262
+ engine.set_log_file(log_output_to)
256
263
 
257
264
  if output_files_to is not None:
258
- engine.set_output_files_dir(output_files_to)
265
+ engine.set_output_dir(output_files_to)
259
266
 
260
267
  engine.print_output_to_stdout = print_tool_output_to_console
261
268
 
@@ -0,0 +1,82 @@
1
+ # This file is part of fm-weck: executing fm-tools in containerized environments.
2
+ # https://gitlab.com/sosy-lab/software/fm-weck
3
+ #
4
+ # SPDX-FileCopyrightText: 2024 Dirk Beyer <https://www.sosy-lab.org>
5
+ #
6
+ # SPDX-License-Identifier: Apache-2.0
7
+
8
+ import logging
9
+ import subprocess
10
+ from pathlib import Path
11
+
12
+ from fm_tools.fmtoolversion import FmToolVersion
13
+
14
+ from .engine import CACHE_MOUNT_LOCATION, Engine
15
+
16
+ logger = logging.getLogger(__name__)
17
+
18
+
19
+ def run_smoke_test(fm_data, shelve_space, config):
20
+ if not shelve_space.exists() or not shelve_space.is_dir():
21
+ raise ValueError(f"Invalid shelve space path: {shelve_space}")
22
+
23
+ engine = Engine.from_config(fm_data, config)
24
+
25
+ tool_dir = shelve_space.relative_to(config.cache_location)
26
+ engine.work_dir = CACHE_MOUNT_LOCATION / tool_dir
27
+
28
+ # Check for smoketest.sh first, then smoke_test.sh
29
+ if (shelve_space / "smoketest.sh").exists():
30
+ command = "./smoketest.sh"
31
+ elif (shelve_space / "smoke_test.sh").exists():
32
+ command = "./smoke_test.sh"
33
+ else:
34
+ raise ValueError(f"Smoke test script not found in {shelve_space}. Expected ./smoketest.sh or ./smoke_test.sh")
35
+
36
+ engine.run(command)
37
+
38
+
39
+ def run_smoke_test_gitlab_ci(fm_data: FmToolVersion, tool_dir: Path):
40
+ """
41
+ Run smoke test in GitLab CI mode.
42
+ This mode directly installs required packages using apt instead of building/pulling images.
43
+
44
+ Args:
45
+ fm_data: The FmToolVersion object containing tool information
46
+ tool_dir: The directory containing the tool's smoke_test.sh script
47
+ """
48
+ # Get required packages from fm_data
49
+ required_packages = fm_data.get_images().required_packages
50
+
51
+ if required_packages:
52
+ logger.info("Installing required packages: %s", " ".join(required_packages))
53
+
54
+ # Install packages
55
+ try:
56
+ subprocess.run(["apt", "install", "-y", *required_packages], check=True)
57
+ logger.info("Successfully installed packages: %s", " ".join(required_packages))
58
+ except subprocess.CalledProcessError:
59
+ logger.error("Failed to install packages.")
60
+ raise
61
+ else:
62
+ logger.info("No required packages specified for this tool")
63
+
64
+ # Run the smoke test script
65
+ # Check for smoketest.sh first, then smoke_test.sh
66
+ smoke_test_script = tool_dir / "smoketest.sh"
67
+ if not smoke_test_script.exists():
68
+ smoke_test_script = tool_dir / "smoke_test.sh"
69
+
70
+ if not smoke_test_script.exists():
71
+ raise ValueError(
72
+ f"Smoke test script not found in downloaded tool directory: {tool_dir}. "
73
+ f"Expected ./smoketest.sh or ./smoke_test.sh"
74
+ )
75
+
76
+ logger.info("Running smoke test script: %s", smoke_test_script)
77
+ try:
78
+ subprocess.run([f"./{smoke_test_script.name}"], cwd=tool_dir, check=True)
79
+ logger.info("Smoke test completed successfully")
80
+ except subprocess.CalledProcessError as e:
81
+ logger.error("Smoke test failed with return code %d", e.returncode)
82
+ raise
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fm-weck
3
- Version: 1.4.8
3
+ Version: 1.5.0
4
4
  Author-email: Henrik Wachowitz <henrik.wachowitz@ifi.lmu.de>
5
5
  Maintainer-email: Henrik Wachowitz <henrik.wachowitz@ifi.lmu.de>
6
6
  Classifier: Development Status :: 4 - Beta
@@ -16,6 +16,8 @@ Requires-Dist: pyyaml>=6.0
16
16
  Requires-Dist: tabulate
17
17
  Requires-Dist: tomli>=2.0; python_version <= '3.10'
18
18
  Requires-Dist: yaspin>=3.0
19
+ Provides-Extra: remote
20
+ Requires-Dist: grpcio-tools; extra == 'remote'
19
21
  Description-Content-Type: text/markdown
20
22
 
21
23
  <!--
@@ -1,22 +1,37 @@
1
- fm_weck/__init__.py,sha256=hwPTOu20emETJm7zBfj7trYoLdZD-A_ZoL0mtmZcyLw,351
1
+ fm_weck/__init__.py,sha256=v0ltYQ0MeG-hs4LVU6TIPeboGSEmIMSDHqOGvQdQR_s,351
2
2
  fm_weck/__main__.py,sha256=IfNDAqM6MK6P7KsQoW3wOHPOscB8evdVlS9C7R4wd_0,391
3
3
  fm_weck/cache_mgr.py,sha256=3-OQFmCeswazXmX08ND4oEHFOR07ZDCwWzjmFTDkOSE,1373
4
- fm_weck/cli.py,sha256=gWiFsbkCOWS6oXTr6srWza-qFrfpU_XR1P-MxHrCQuM,17136
4
+ fm_weck/capture.py,sha256=iogn3JvCZEjD0SQL8Xa3TzmZAWifd9ZIP81c3JIsdUQ,982
5
+ fm_weck/cli.py,sha256=dPpJqyF0iXqZuRiPATypDbc6TyaUWzUFpb1qc2uo-mg,23657
5
6
  fm_weck/config.py,sha256=8XXlHbb9cW1N1jatNFY5AnaRdxsSz-ohCrqq5t90RAc,8099
6
- fm_weck/engine.py,sha256=zway0nC4piPohK3hoBYr9Sv3xAa32dLeuPSuOw1Wers,17376
7
- fm_weck/exceptions.py,sha256=xXxbYK-FZW6YksBtaN79KaA4fGnFCBO-wc0QMqtq3Og,282
8
- fm_weck/file_util.py,sha256=R9y6LUZCDNJR4j25_Q24lN_zhACnOjYP5BvcpYaQPiA,649
9
- fm_weck/image_mgr.py,sha256=mDqP-YD6AEOW2xldYJ4D-wxYKF0Ta5SgoJiX2CrhyQg,1906
10
- fm_weck/run_result.py,sha256=0d8G3py1VCPP4jLxPCVzL8Vljvrwt9IHlmvCkW0pwx8,1249
7
+ fm_weck/engine.py,sha256=HfRj5Okewteco7A-CccCIbk2aEGDh4K896YyQo7h1gE,21733
8
+ fm_weck/exceptions.py,sha256=AfqTt6gxZPUQ0rKqwgdGTyfIjWmU3xBFIJxQnMLbLGo,2465
9
+ fm_weck/file_util.py,sha256=FG_uBuNWGWbSivBv0dYzwugMkGfdS_iFY-hG6GLDD54,799
10
+ fm_weck/image_mgr.py,sha256=lkn1nWuwKtMhtVf_PFZOOJftY5uyE0EydY2f-sefHGE,1943
11
+ fm_weck/run_result.py,sha256=srg3w2MvC-2YqgpRtqrat2DoxhErtlc5FQO3uaFaGTI,1253
11
12
  fm_weck/runexec_mode.py,sha256=UamxVvYm0XErPjR2sRJaLMX8uHBzRcgCTWbQIZjdju0,2195
12
13
  fm_weck/runexec_util.py,sha256=YBvVIPpmEousZVxbZ5NS8jzpKPLyws31kIFE2z3Ki2E,1370
13
- fm_weck/serve.py,sha256=mDaZ1BUKwUh_fPgGMR4LXrJ1c5GOmwwXbHbMllmJzi8,10608
14
+ fm_weck/serve.py,sha256=RUz_3v15By_CvcBJlNBw-mKuDubAiIha5EfayFBnqps,10728
15
+ fm_weck/smoke_test_mode.py,sha256=SYXLf1mhdGEOS9YtJ7XuR8j_zfN9zUWhu1KSm4zgAR4,2990
14
16
  fm_weck/tmp_file.py,sha256=oJiE8VGTPxhl-bXdtbM8eNqQ4e9ECPG1jDmiboVDo_k,1956
15
17
  fm_weck/version_listing.py,sha256=caaoC3n9R-Ao2sEQ_ngOVO3bnKr7cNVeH6EiA8jO5Sc,864
18
+ fm_weck/grpc_service/__init__.py,sha256=TvQSR0pVeh4MMMT40VfzJFyZTHpAOI7C808vjJpWiOs,390
19
+ fm_weck/grpc_service/fm_weck_client.py,sha256=xd3ltrHcJ1fdl9V3PUFNukJahoMP_VavXTwEbPcjMyk,4862
20
+ fm_weck/grpc_service/fm_weck_server.py,sha256=kYrhi2Egp09yMP_4-AaW5k9lGd63HTD3KekBFSsG2dk,6142
21
+ fm_weck/grpc_service/request_handling.py,sha256=w_ZNZ1PK22D6SoBMc-hqXhy6S48kmksMXu-wSniYLSU,10912
22
+ fm_weck/grpc_service/run_store.py,sha256=6pm_b2PCPys6qmVQvxq8qUpREdBsdOPpvOhTOfh-Rjc,864
23
+ fm_weck/grpc_service/server_utils.py,sha256=1A3_RdjsvkeCV2w1oZemd4v9YcpcWWwgjy62jF0wUmM,721
24
+ fm_weck/grpc_service/proto/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
25
+ fm_weck/grpc_service/proto/fm_weck_service.proto,sha256=HcRpwWnNTxHEGxitZZb_RcXTQX97erySKItGCg0AhBw,3316
26
+ fm_weck/grpc_service/proto/fm_weck_service_pb2.py,sha256=O8qtEYv77kGKaBbo-AXGTxYJTSTo6rBHN03PIZJB3cA,5647
27
+ fm_weck/grpc_service/proto/fm_weck_service_pb2.pyi,sha256=JH44EhTejp9Nk1dlnPuen2ZVp0WeAnbSvrT6FL9ihJg,6391
28
+ fm_weck/grpc_service/proto/fm_weck_service_pb2_grpc.py,sha256=YCnAPNEGQUNqgVzGB_JeV01fxsiiC7VlP0Aos-n5gWE,12076
29
+ fm_weck/grpc_service/proto/generate_protocol_files.sh,sha256=F9dd95qKejtB7B3P-x9d2oAr9VrW9AZRMfm8KKRKLpk,801
16
30
  fm_weck/resources/BenchExec-3.27-py3-none-any.whl,sha256=g-db8LM8HfqLhbnl7n5lvUbMnF2tZ4MHAVOxTGxqO8w,732849
17
31
  fm_weck/resources/BenchExec-3.27-py3-none-any.whl.license,sha256=Nq2Mwgn_pyr6ZZrTT095QPtFP3hr15ZeIRIaY0B7eC8,201
18
- fm_weck/resources/Containerfile,sha256=MltxP1of9klsQFNR8WyngRTJrPwxQTF4C9ennRxVqSo,391
19
- fm_weck/resources/__init__.py,sha256=-YLqFTF2Gu4RA9ye3SdvBk1rjhlYxk_f1TgPsix3SAk,1213
32
+ fm_weck/resources/Containerfile,sha256=HpPkrzJe1IKsmLOfbe5LbT-suaV6eJn1fT4csSvEkOk,390
33
+ fm_weck/resources/__init__.py,sha256=Gd3SNYBUUgDCJFMVwaaPynmugTUKoWamBXRhbasRKJE,1522
34
+ fm_weck/resources/c_program_example.c,sha256=WOTAn4XyQL8TlplI6M8FbKiUxiwnvHUy2o6n0hLIe6o,21862
20
35
  fm_weck/resources/run_with_overlay.sh,sha256=v1gV_6kMQ0v9BQ3chgDqI1MAOLHbPWeeTC52aCqVpEM,1162
21
36
  fm_weck/resources/runexec,sha256=ogIBO38HLu9C9kDTTANBgAqVnH-UIF1bSJ9d3DSjyF4,462
22
37
  fm_weck/resources/properties/coverage-branches.prp,sha256=Gl2r1cgBFoh4M2laa8dVGhteHkL04oiBRLzxz_hbkEU,56
@@ -150,7 +165,7 @@ fm_weck/resources/fm_tools/wit4java.yml,sha256=ylfze2XbV4zKkVUH57Veqn7G49gW0Byxd
150
165
  fm_weck/resources/fm_tools/witch.yml,sha256=wwe6lrI2sxGKVZbLeipa38rPhB2pcSUFi9uVngtXGUQ,1795
151
166
  fm_weck/resources/fm_tools/witnesslint.yml,sha256=EvMBcm5fx6lgSLRmHSKXSxXIJKZ-BrxLwTXI4GQ6FMs,6812
152
167
  fm_weck/resources/fm_tools/witnessmap.yml,sha256=FyZtEloxpWBBjLn9kyqoen2kPjOkH2r4fxAj5gfV8Bg,1692
153
- fm_weck-1.4.8.dist-info/METADATA,sha256=gGPe1x8nywUCLB85Ldg2MTFg4j7gMU8LRPFarOjIQKo,3269
154
- fm_weck-1.4.8.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
155
- fm_weck-1.4.8.dist-info/entry_points.txt,sha256=toWpKCSY1u593MPnI_xW5gnwlnkerP4AvmPQ1s2nPgY,50
156
- fm_weck-1.4.8.dist-info/RECORD,,
168
+ fm_weck-1.5.0.dist-info/METADATA,sha256=UqR47gDzSfO-MS7U0lEmpMoYJ5Xe6Vx_4cxMXg7qq-0,3339
169
+ fm_weck-1.5.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
170
+ fm_weck-1.5.0.dist-info/entry_points.txt,sha256=toWpKCSY1u593MPnI_xW5gnwlnkerP4AvmPQ1s2nPgY,50
171
+ fm_weck-1.5.0.dist-info/RECORD,,