@@ -85,9 +85,20 @@ groups:
8585 type : string
8686 required : true
8787 run : |
88+ import subprocess
89+
8890 for name in "${{ args.examples }}".split(","):
8991 print(f" show tokens: {name} ".center(80, "="))
90- arx --show-tokens examples/@(name).x
92+ result = subprocess.run(
93+ ["arx", "--show-tokens", f"examples/{name}.x"],
94+ capture_output=True,
95+ text=True,
96+ check=True,
97+ )
98+ output = result.stdout.strip()
99+ if not output:
100+ raise RuntimeError(f"show-tokens produced no output for: {name}")
101+ print(output)
91102 show-ast :
92103 help : Emit ast for input file
93104 args :
@@ -96,9 +107,25 @@ groups:
96107 type : string
97108 required : true
98109 run : |
110+ import subprocess
111+
99112 for name in "${{ args.examples }}".split(","):
100113 print(f" show ast: {name} ".center(80, "="))
101- arx --show-ast examples/@(name).x
114+ result = subprocess.run(
115+ ["arx", "--show-ast", f"examples/{name}.x"],
116+ capture_output=True,
117+ text=True,
118+ check=True,
119+ )
120+ output = result.stdout.strip()
121+ if not output:
122+ raise RuntimeError(f"show-ast produced no output for: {name}")
123+ if output == "Block":
124+ raise RuntimeError(
125+ "show-ast regression: got only 'Block'. "
126+ f"example={name}"
127+ )
128+ print(output)
102129 show-llvm-ir :
103130 help : Emit ast for input file
104131 args :
@@ -107,9 +134,23 @@ groups:
107134 type : string
108135 required : true
109136 run : |
137+ import subprocess
138+
110139 for name in "${{ args.examples }}".split(","):
111140 print(f" show llvm ir: {name} ".center(80, "="))
112- arx --show-llvm-ir examples/@(name).x
141+ result = subprocess.run(
142+ ["arx", "--show-llvm-ir", f"examples/{name}.x"],
143+ capture_output=True,
144+ text=True,
145+ check=True,
146+ )
147+ output = result.stdout.strip()
148+ if "; ModuleID" not in output:
149+ raise RuntimeError(
150+ "show-llvm-ir output missing LLVM header for: "
151+ f"{name}"
152+ )
153+ print(output)
113154 emit-object :
114155 help : Emit ast for input file
115156 args :
@@ -118,9 +159,34 @@ groups:
118159 type : string
119160 required : true
120161 run : |
162+ import subprocess
163+
164+ from pathlib import Path
165+
166+ output_dir = Path("build/smoke")
167+ output_dir.mkdir(parents=True, exist_ok=True)
168+
121169 for name in "${{ args.examples }}".split(","):
122170 print(f" emit object: {name} ".center(80, "="))
123- arx examples/@(name).x
171+ output_file = output_dir / name
172+ if output_file.exists():
173+ output_file.unlink()
174+ subprocess.run(
175+ [
176+ "arx",
177+ f"examples/{name}.x",
178+ "--lib",
179+ "--output-file",
180+ str(output_file),
181+ ],
182+ check=True,
183+ )
184+ if not output_file.exists() or output_file.stat().st_size == 0:
185+ raise RuntimeError(
186+ "emit-object did not produce a valid artifact for: "
187+ f"{name}"
188+ )
189+ print(str(output_file))
124190
125191 docs :
126192 tasks :
0 commit comments