33# This program is free software you can redistribute it and/or modify it
44# under the terms of the license (GNU LGPL) which comes with this package.
55
6+ import os
67import sys
78import multiprocessing
89from simgrid import Engine , this_actor
910from fsmod import FileSystem , OneDiskStorage
1011from dtlmod import DTL , Stream , Transport , Engine as DTLEngine
1112
13+ # Locate DTL-config.json relative to this script rather than to the current working directory, so the test can be
14+ # launched from anywhere. CMake stages the file under <build>/config_files/test/ (canonical, used by CI); the second
15+ # candidate is the source-tree location (test/DTL-config.json) so the test also works when run from the sources.
16+ _HERE = os .path .dirname (os .path .abspath (__file__ ))
17+ _CONFIG_CANDIDATES = [
18+ os .path .join (_HERE , ".." , ".." , "config_files" , "test" , "DTL-config.json" ),
19+ os .path .join (_HERE , ".." , "DTL-config.json" ),
20+ ]
21+
22+
23+ def config_file_path ():
24+ for candidate in _CONFIG_CANDIDATES :
25+ if os .path .exists (candidate ):
26+ return candidate
27+ raise FileNotFoundError ("DTL-config.json not found in any of: " + ", " .join (_CONFIG_CANDIDATES ))
28+
29+
1230def setup_platform ():
1331 e = Engine (sys .argv )
1432 e .set_log_control ("no_loc" )
@@ -24,7 +42,7 @@ def setup_platform():
2442 FileSystem .register_file_system (root , fs )
2543 fs .mount_partition ("/scratch/" , local_storage , "100MB" )
2644
27- DTL .create ("../../config_files/test/DTL-config.json" )
45+ DTL .create (config_file_path () )
2846 return e , host
2947
3048def run_test_config_file ():
0 commit comments