Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
eclipse
GitHub Repository: eclipse/sumo
Path: blob/main/tests/netedit/testoutput.py
185785 views
1
#!/usr/bin/env python3
2
# Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3
# Copyright (C) 2025-2025 German Aerospace Center (DLR) and others.
4
# This program and the accompanying materials are made available under the
5
# terms of the Eclipse Public License 2.0 which is available at
6
# https://www.eclipse.org/legal/epl-2.0/
7
# This Source Code may also be made available under the following Secondary
8
# Licenses when the conditions for such availability set forth in the Eclipse
9
# Public License 2.0 are satisfied: GNU General Public License, version 2
10
# or later which is available at
11
# https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12
# SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13
14
# @file testoutput.py
15
# @author Pablo Alvarez Lopez
16
# @date 2025-12-05
17
18
import os
19
import subprocess
20
import sys
21
22
# Mappings as a list of lists: [ [left_path, right_path], ... ]
23
mappings = [
24
["netedit_A.netedit", "netedit_A.netecfg"],
25
["netedit_B.netedit", "netedit_B.netecfg"],
26
["sumo_A.netedit", "sumo_A.sumocfg"],
27
["sumo_B.netedit", "sumo_B.sumocfg"],
28
["sumo.netedit", "sumo.sumocfg"],
29
["netconvert_A.netedit", "netconvert_A.netccfg"],
30
["netconvert_B.netedit", "netconvert_B.netccfg"],
31
["input_net_A_net_xml.netedit", "input_net_A.net.xml"],
32
["input_net_A_xml_gz.netedit", "input_net_A.net.xml.gz"],
33
["input_net_A_xml.netedit", "input_net_A.xml"],
34
["input_net_A_txt.netedit", "input_net_A.txt"],
35
["input_net_B_net_xml.netedit", "input_net_B.net.xml"],
36
["input_net_B_xml_gz.netedit", "input_net_B.net.xml.gz"],
37
["input_net_B_xml.netedit", "input_net_B.xml"],
38
["input_net_B_txt.netedit", "input_net_B.txt"],
39
["input_netconvert_A_con_xml.netedit", "input_netconvert_A.con.xml"],
40
["input_netconvert_A_edg_xml.netedit", "input_netconvert_A.edg.xml"],
41
["input_netconvert_A_nod_xml.netedit", "input_netconvert_A.nod.xml"],
42
["input_netconvert_A_tll_xml.netedit", "input_netconvert_A.tll.xml"],
43
["input_netconvert_B_con_xml.netedit", "input_netconvert_B.con.xml"],
44
["input_netconvert_B_edg_xml.netedit", "input_netconvert_B.edg.xml"],
45
["input_netconvert_B_nod_xml.netedit", "input_netconvert_B.nod.xml"],
46
["input_netconvert_B_tll_xml.netedit", "input_netconvert_B.tll.xml"],
47
["netedit_A_add_xml.netedit", "netedit_A.add.xml"],
48
["netedit_B_add_xml.netedit", "netedit_B.add.xml"],
49
["sumo_A_add_xml.netedit", "sumo_A.add.xml"],
50
["sumo_B_add_xml.netedit", "sumo_B.add.xml"],
51
["input_additionals_A_add_xml.netedit", "input_additionals_A.add.xml"],
52
["input_additionals_A_add_xml_gz.netedit", "input_additionals_A.add.xml.gz"],
53
["input_additionals_A_xml.netedit", "input_additionals_A.xml"],
54
["input_additionals_A_xml_gz.netedit", "input_additionals_A.xml.gz"],
55
["input_additionals_A_txt.netedit", "input_additionals_A.txt"],
56
["input_additionals_B_add_xml.netedit", "input_additionals_B.add.xml"],
57
["input_additionals_B_add_xml_gz.netedit", "input_additionals_B.add.xml.gz"],
58
["input_additionals_B_xml.netedit", "input_additionals_B.xml"],
59
["input_additionals_B_xml_gz.netedit", "input_additionals_B.xml.gz"],
60
["input_additionals_B_txt.netedit", "input_additionals_B.txt"],
61
["netedit_A_rou_xml.netedit", "netedit_A.rou.xml"],
62
["netedit_B_rou_xml.netedit", "netedit_B.rou.xml"],
63
["sumo_A_rou_xml.netedit", "sumo_A.rou.xml"],
64
["sumo_B_rou_xml.netedit", "sumo_B.rou.xml"],
65
["input_routes_A_rou_xml.netedit", "input_routes_A.rou.xml"],
66
["input_routes_A_rou_xml_gz.netedit", "input_routes_A.rou.xml.gz"],
67
["input_routes_A_xml.netedit", "input_routes_A.xml"],
68
["input_routes_A_xml_gz.netedit", "input_routes_A.xml.gz"],
69
["input_routes_A_txt.netedit", "input_routes_A.txt"],
70
["input_routes_B_rou_xml.netedit", "input_routes_B.rou.xml"],
71
["input_routes_B_rou_xml_gz.netedit", "input_routes_B.rou.xml.gz"],
72
["input_routes_B_xml.netedit", "input_routes_B.xml"],
73
["input_routes_B_xml_gz.netedit", "input_routes_B.xml.gz"],
74
["input_routes_B_txt.netedit", "input_routes_B.txt"],
75
["netedit_A_dat_xml.netedit", "netedit_A.dat.xml"],
76
["netedit_B_dat_xml.netedit", "netedit_B.dat.xml"],
77
["sumo_A_dat_xml.netedit", "sumo_A.dat.xml"],
78
["sumo_B_dat_xml.netedit", "sumo_B.dat.xml"],
79
["input_datas_A_dat_xml.netedit", "input_datas_A.dat.xml"],
80
["input_datas_A_dat_xml_gz.netedit", "input_datas_A.dat.xml.gz"],
81
["input_datas_A_xml.netedit", "input_datas_A.xml"],
82
["input_datas_A_xml_gz.netedit", "input_datas_A.xml.gz"],
83
["input_datas_A_txt.netedit", "input_datas_A.txt"],
84
["input_datas_B_dat_xml.netedit", "input_datas_B.dat.xml"],
85
["input_datas_B_dat_xml_gz.netedit", "input_datas_B.dat.xml.gz"],
86
["input_datas_B_xml.netedit", "input_datas_B.xml"],
87
["input_datas_B_xml_gz.netedit", "input_datas_B.xml.gz"],
88
["input_datas_B_txt.netedit", "input_datas_B.txt"],
89
["netedit_A_dat_add_xml.netedit", "netedit_A.dat.add.xml"],
90
["netedit_B_dat_add_xml.netedit", "netedit_B.dat.add.xml"],
91
["sumo_A_dat_add_xml.netedit", "sumo_A.dat.add.xml"],
92
["sumo_B_dat_add_xml.netedit", "sumo_B.dat.add.xml"],
93
["input_meandatas_A_add_xml.netedit", "input_meandatas_A.add.xml"],
94
["input_meandatas_A_add_xml_gz.netedit", "input_meandatas_A.add.xml.gz"],
95
["input_meandatas_A_xml.netedit", "input_meandatas_A.xml"],
96
["input_meandatas_A_xml_gz.netedit", "input_meandatas_A.xml.gz"],
97
["input_meandatas_A_txt.netedit", "input_meandatas_A.txt"],
98
["input_meandatas_B_add_xml.netedit", "input_meandatas_B.add.xml"],
99
["input_meandatas_B_add_xml_gz.netedit", "input_meandatas_B.add.xml.gz"],
100
["input_meandatas_B_xml.netedit", "input_meandatas_B.xml"],
101
["input_meandatas_B_xml_gz.netedit", "input_meandatas_B.xml.gz"],
102
["input_meandatas_B_txt.netedit", "input_meandatas_B.txt"],
103
]
104
105
106
def main():
107
# replace all files
108
for src, dst in mappings:
109
if os.path.exists(src):
110
os.replace(src, dst)
111
# get sumo
112
sumo = os.environ.get("SUMO_BINARY")
113
if not sumo:
114
print("Error: SUMO_BINARY must be defined", file=sys.stderr)
115
sys.exit(2)
116
# run sumo
117
rc = subprocess.run([sumo, "-c", "sumo.sumocfg", "--no-step-log", "--no-duration-log"]).returncode
118
sys.exit(rc)
119
120
121
if __name__ == "__main__":
122
main()
123
124