diff --git a/vars/kola.groovy b/vars/kola.groovy index 930f654..257adad 100644 --- a/vars/kola.groovy +++ b/vars/kola.groovy @@ -31,7 +31,7 @@ def call(params = [:]) { def token = shwrapCapture("uuidgen | cut -f1 -d-") // Create a unique output directory for this run of kola - def outputDir = shwrapCapture("cosa shell -- mktemp -d ${cosaDir}/tmp/kola-XXXXX") + def outputDir = shwrapCapture("cd ${cosaDir} && cosa shell -- mktemp -d ${cosaDir}/tmp/kola-XXXXX") // list of identifiers for each run for log collection def ids = [] @@ -61,8 +61,8 @@ def call(params = [:]) { shwrap("mkdir -p /var/tmp/kola && ln -s ${env.WORKSPACE} /var/tmp/kola/${name}") } else { shwrap(""" - cosa shell -- mkdir -p /var/tmp/kola - cosa remote-session sync ${env.WORKSPACE}/ :/var/tmp/kola/${name}/ + cd ${cosaDir} && cosa shell -- mkdir -p /var/tmp/kola + cd ${cosaDir} && cosa remote-session sync ${env.WORKSPACE}/ :/var/tmp/kola/${name}/ """) } args += "--exttest /var/tmp/kola/${name}" @@ -87,23 +87,23 @@ def call(params = [:]) { // do a single run in that case. id = marker == "" ? "kola" : "kola-${marker}" ids += id - shwrap("cosa kola run ${rerun} --output-dir=${outputDir}/${id} --build=${buildID} ${archArg} ${platformArgs} --parallel ${parallel} ${args} ${extraArgs}") + shwrap("cd ${cosaDir} && cosa kola run ${rerun} --output-dir=${outputDir}/${id} --build=${buildID} ${archArg} ${platformArgs} --parallel ${parallel} ${args} ${extraArgs}") } else { // basic run if (!params['skipBasicScenarios']) { id = marker == "" ? "kola-basic" : "kola-basic-${marker}" ids += id - shwrap("cosa kola run ${rerun} --output-dir=${outputDir}/${id} --basic-qemu-scenarios") + shwrap("cd ${cosaDir} && cosa kola run ${rerun} --output-dir=${outputDir}/${id} --basic-qemu-scenarios") } // normal run (without reprovision tests because those require a lot of memory) id = marker == "" ? "kola" : "kola-${marker}" ids += id - shwrap("cosa kola run ${rerun} --output-dir=${outputDir}/${id} --build=${buildID} ${archArg} ${platformArgs} --tag '!reprovision' --parallel ${parallel} ${args}") + shwrap("cd ${cosaDir} && cosa kola run ${rerun} --output-dir=${outputDir}/${id} --build=${buildID} ${archArg} ${platformArgs} --tag '!reprovision' --parallel ${parallel} ${args}") // re-provision tests (not run with --parallel argument to kola) id = marker == "" ? "kola-reprovision" : "kola-reprovision-${marker}" ids += id - shwrap("cosa kola run ${rerun} --output-dir=${outputDir}/${id} --build=${buildID} ${archArg} ${platformArgs} --tag reprovision ${args}") + shwrap("cd ${cosaDir} && cosa kola run ${rerun} --output-dir=${outputDir}/${id} --build=${buildID} ${archArg} ${platformArgs} --tag reprovision ${args}") } } @@ -115,7 +115,7 @@ def call(params = [:]) { try { def id = marker == "" ? "kola-upgrade" : "kola-upgrade-${marker}" ids += id - shwrap("cosa kola ${rerun} --output-dir=${outputDir}/${id} --upgrades --build=${buildID} ${archArg} ${platformArgs}") + shwrap("cd ${cosaDir} && cosa kola ${rerun} --output-dir=${outputDir}/${id} --upgrades --build=${buildID} ${archArg} ${platformArgs}") } catch(e) { if (params["allowUpgradeFail"]) { warnError(message: 'Upgrade Failed') { @@ -128,22 +128,19 @@ def call(params = [:]) { } } - // Run the Kola tests from the cosaDir - dir(cosaDir) { - try { - if (kolaRuns.size() == 1) { - kolaRuns.each { k, v -> v() } - } else { - parallel(kolaRuns) - } - } finally { - for (id in ids) { - // sanity check kola actually ran and dumped its output - shwrap("cosa shell -- test -d ${outputDir}/${id}") - // collect the output - shwrap("cosa shell -- tar -c --xz ${outputDir}/${id} > ${env.WORKSPACE}/${id}-${token}.tar.xz || :") - archiveArtifacts allowEmptyArchive: true, artifacts: "${id}-${token}.tar.xz" - } + try { + if (kolaRuns.size() == 1) { + kolaRuns.each { k, v -> v() } + } else { + parallel(kolaRuns) + } + } finally { + for (id in ids) { + // sanity check kola actually ran and dumped its output + shwrap("cd ${cosaDir} && cosa shell -- test -d ${outputDir}/${id}") + // collect the output + shwrap("cd ${cosaDir} && cosa shell -- tar -c --xz ${outputDir}/${id} > ${env.WORKSPACE}/${id}-${token}.tar.xz || :") + archiveArtifacts allowEmptyArchive: true, artifacts: "${id}-${token}.tar.xz" } } } diff --git a/vars/kolaTestIso.groovy b/vars/kolaTestIso.groovy index 3a594b3..d0c13e0 100644 --- a/vars/kolaTestIso.groovy +++ b/vars/kolaTestIso.groovy @@ -34,7 +34,7 @@ def call(params = [:]) { def token = shwrapCapture("uuidgen | cut -f1 -d-") // Create a unique output directory for this run of fcosKola - def outputDir = shwrapCapture("cosa shell -- mktemp -d ${cosaDir}/tmp/kolaTestIso-XXXXX") + def outputDir = shwrapCapture("cd ${cosaDir} && cosa shell -- mktemp -d ${cosaDir}/tmp/kolaTestIso-XXXXX") // list of identifiers for each run for log collection def ids = [] @@ -44,7 +44,7 @@ def call(params = [:]) { def id = marker == "" ? "kola-testiso-metal" : "kola-testiso-metal-${marker}" ids += id def scenariosArg = scenarios == "" ? "" : "--scenarios ${scenarios}" - shwrap("cosa kola testiso -S ${extraArgs} ${scenariosArg} --output-dir ${outputDir}/${id}") + shwrap("cd ${cosaDir} && cosa kola testiso -S ${extraArgs} ${scenariosArg} --output-dir ${outputDir}/${id}") } if (!params['skipMetal4k']) { // metal4k test doesn't work on s390x for now @@ -55,7 +55,7 @@ def call(params = [:]) { def id = marker == "" ? "kola-testiso-metal4k" : "kola-testiso-metal4k-${marker}" ids += id def scenariosArg = scenarios4k == "" ? "" : "--scenarios ${scenarios4k}" - shwrap("cosa kola testiso -S --qemu-native-4k ${extraArgs4k} ${scenariosArg} --output-dir ${outputDir}/${id}") + shwrap("cd ${cosaDir} && cosa kola testiso -S --qemu-native-4k ${extraArgs4k} ${scenariosArg} --output-dir ${outputDir}/${id}") } } } @@ -63,7 +63,7 @@ def call(params = [:]) { testIsoRuns["${arch}:kola:multipath"] = { def id = marker == "" ? "kola-testiso-multipath" : "kola-testiso-multipath-${marker}" ids += id - shwrap("cosa kola testiso -S --qemu-multipath ${extraArgsMultipath} --scenarios ${scenariosMultipath} --output-dir ${outputDir}/${id}") + shwrap("cd ${cosaDir} && cosa kola testiso -S --qemu-multipath ${extraArgsMultipath} --scenarios ${scenariosMultipath} --output-dir ${outputDir}/${id}") } } if (!params['skipUEFI']) { @@ -76,32 +76,29 @@ def call(params = [:]) { testIsoRuns["${arch}:kola:uefi"] = { def id = marker == "" ? "kola-testiso-uefi" : "kola-testiso-uefi-${marker}" ids += id - shwrap("cosa shell -- mkdir -p ${outputDir}/${id}") - shwrap("cosa kola testiso -S --qemu-firmware=uefi ${extraArgsUEFI} --scenarios ${scenariosUEFI} --output-dir ${outputDir}/${id}/insecure") - shwrap("cosa kola testiso -S --qemu-firmware=uefi-secure ${extraArgsUEFI} --scenarios ${scenariosUEFI} --output-dir ${outputDir}/${id}/secure") + shwrap("cd ${cosaDir} && cosa shell -- mkdir -p ${outputDir}/${id}") + shwrap("cd ${cosaDir} && cosa kola testiso -S --qemu-firmware=uefi ${extraArgsUEFI} --scenarios ${scenariosUEFI} --output-dir ${outputDir}/${id}/insecure") + shwrap("cd ${cosaDir} && cosa kola testiso -S --qemu-firmware=uefi-secure ${extraArgsUEFI} --scenarios ${scenariosUEFI} --output-dir ${outputDir}/${id}/secure") } } } - // Run the Kola tests from the cosaDir - dir(cosaDir) { - try { - // Run at most two testiso runs at a time to try not to - // exceed 8G of memory usage. - def runs = [:] - testIsoRuns.eachWithIndex { key, value, index -> - def i = index + 1 // index starts at 0, adjust - runs[key] = value - if (i % 2 == 0 || i == testIsoRuns.size()) { - parallel runs - runs = [:] // empty out map for next iteration - } - } - } finally { - for (id in ids) { - shwrap("cosa shell -- tar -c --xz ${outputDir}/${id} > ${env.WORKSPACE}/${id}-${token}.tar.xz || :") - archiveArtifacts allowEmptyArchive: true, artifacts: "${id}-${token}.tar.xz" + try { + // Run at most two testiso runs at a time to try not to + // exceed 8G of memory usage. + def runs = [:] + testIsoRuns.eachWithIndex { key, value, index -> + def i = index + 1 // index starts at 0, adjust + runs[key] = value + if (i % 2 == 0 || i == testIsoRuns.size()) { + parallel runs + runs = [:] // empty out map for next iteration } } + } finally { + for (id in ids) { + shwrap("cd ${cosaDir} && cosa shell -- tar -c --xz ${outputDir}/${id} > ${env.WORKSPACE}/${id}-${token}.tar.xz || :") + archiveArtifacts allowEmptyArchive: true, artifacts: "${id}-${token}.tar.xz" + } } }