a ͐Yg@sddlZddlZddlZddlZddlZddlZddlZddlZddlZddl Zddl Z da da da iaddZddZddZd d d ZdS) NcCs dtjjdatjjr8tdtjjddd7atjjrZttjjddd7attj d7atdt t ddd7atjjrtjjattntjtdd atttd ttjjstjd rtjjd d gd dtjjddtd gd ddS)Nztestenv--*:z %Y%m%d-%H%Mr)prefixz Logging to: /tmp/logsrmT no_podmanZlnz-sf)testenvargs testsuiterconfigjoinreplace binary_repodatetimenowstrftimestruuidZuuid4splitlog_dirtestdir_topdirosmakedirstempfileZmkdtempatexitregistercleanlogginginfopathexistscmdrunr'r']/home/osmocom-build/jenkins/workspace/ttcn3-bsc-test-vamos-latest/_testenv/testenv/testdir.pyinits" "   r)c Cst}tjjr tj|d|}ttjj dkr6|a ntj|| dd dda t dt tjtjjtjj}tt|D]}|dvrq||}tjt |}t|d|vr|d kr|d}tj||} tj||} tjd d | | gd |vr|d d } tjjddg| |gd|dqtj|d} t| D]2} tjt d tj| } tjd d | | gqNtjt d d} tjtjjd} tjd d | | gtjdddtjjd| gtjjrdnd}d|d}tjt dtjt dg}|D]N} tj| ddD]8}t d|tjddd d!|d"d d#|gq(q|D]}|dvr|qj||}tjt |}d$|vrt d%|d&|d$t|<d'd(i}tjj|d$||d)d(|vrjt d%|d*tjj|d(|d+qjdS),Nzloop-rZtestenv_rz.cfgzPreparing testdir: )DEFAULTrrinstallz-Dm644copy Zcpz-aT)r cwdz *.defaultz Common.cfgZsedz-iz.s#TTCN3_HACKS_PATH := .*#TTCN3_HACKS_PATH := "z"#latestZnightlyzMisc_Helpers.mp_osmo_repo := ""ztestsuite/**/*.cfgztestsuite/**/*.default) recursivezAdjusting testsuite config: z-ez/s/\[MODULE_PARAMETERS\]/\[MODULE_PARAMETERS\]\nz/gzs#../Common.cfg#Common.cfg#r Running z clean script (reason: prepare)TESTENV_CLEAN_REASONpreparer.envz prepare script)r.)rr r until_nokrr#rlen testenv_cfgcfgstestdirrr!r"rttcn3_hacks_dirrrclean_run_scriptsrr%r&rglobbasenamer/debug clean_scripts)cfg_namecfg loop_counttopdir testsuite_dirsection section_dataZ section_dirfiler#Z path_destZsourcespatternZ common_cfgZ mp_osmo_repolinepatternsZcfg_filer6r'r'r(r46s  "          r4cCsttr\d}tjd}|r0|d|d7}n|dt7}tjjsN|d7}t |dSt dtj j dd tgd d tjjstj d rtj d stj j dd gd d dS) zfDon't leave behind an empty testdir_topdir, e.g. if testenv.py aborted during build of components.zLogs saved to:Z BUILD_URLr-zartifact/logs/ z (symlink: /tmp/logs)NzRemoving empty log dirr z-dTr r)rlistdirrenvirongetr r rr!r"r@r%r&r#lexistsr$)msgZurlr'r'r(r s     r crashedcCs|tsdStjjr&tjs&tdnNtD]D\}}td|d|dd|i}tj j |t j t||dq.iadS)Nz?Skipping clean up scripts, podman container has already stoppedr2z clean script (reason: )r3r5)rAr r podman is_runningr!r@itemsr"r%r&rr#rr;)reasonrGZscriptr6r'r'r(r=s r=)rR)rrr>r!ros.pathrr testenv.cmdtestenv.testsuiterr;rrrAr)r4r r=r'r'r'r(s$c