@@ -298,3 +298,65 @@ def test_check_install_fail(tmpdir):
298298 "--check" ,
299299 ]
300300 )
301+
302+
303+ @pytest .mark .long_running
304+ @pytest .mark .skipif (not sys .platform .startswith ("linux" ), reason = "Linux only" )
305+ def test_linux_perf (tmpdir ):
306+ """
307+ Tests the whole workflow from a clean benchmarking repo.
308+ """
309+ repo = tmpdir / "repo"
310+ venv_dir = repo / "outer_venv"
311+ bench_runner_checkout = DATA_PATH .parents [1 ]
312+ if sys .platform .startswith ("win" ):
313+ binary = venv_dir / "Scripts" / "python.exe"
314+ else :
315+ binary = venv_dir / "bin" / "python"
316+ profiling_dir = Path (repo / "profiling" / "results" )
317+
318+ repo .mkdir ()
319+ Path (profiling_dir ).mkdir (parents = True )
320+
321+ with contextlib .chdir (repo ):
322+ subprocess .check_call ([sys .executable , "-m" , "venv" , str (venv_dir )])
323+ subprocess .check_call (
324+ [
325+ str (binary ),
326+ "-m" ,
327+ "pip" ,
328+ "install" ,
329+ "--upgrade" ,
330+ "pip" ,
331+ ]
332+ )
333+ subprocess .check_call (
334+ [str (binary ), "-m" , "pip" , "install" , f"{ bench_runner_checkout } [test]" ]
335+ )
336+ subprocess .check_call ([str (binary ), "-m" , "bench_runner" , "install" ])
337+ with open ("requirements.txt" , "w" ) as fd :
338+ fd .write (f"{ str (bench_runner_checkout )} \n " )
339+ subprocess .check_call (
340+ [
341+ str (binary ),
342+ "workflow_bootstrap.py" ,
343+ "python" ,
344+ "main" ,
345+ "linux-x86_64-linux" ,
346+ "deltablue" ,
347+ ",,," ,
348+ "--_fast" ,
349+ "--perf" ,
350+ ]
351+ )
352+
353+ csv_file = profiling_dir / "deltablue.perf.csv"
354+ assert csv_file .is_file ()
355+
356+ with open (csv_file , "r" ) as fd :
357+ lines = iter (fd .readlines ())
358+ first_line = next (lines )
359+ assert first_line .strip () == "self,pid,command,shared_obj,symbol"
360+ for line in fd .readlines ():
361+ assert line .strip ().endswith ("_PyEval_EvalFrameDefault" )
362+ break
0 commit comments