Commit d6547a1c authored by Michael Hanselmann's avatar Michael Hanselmann
Browse files

Generate import-export unittest certs in parallel



Generating certificates can be slow.
Signed-off-by: default avatarMichael Hanselmann <hansmi@google.com>
Reviewed-by: default avatarIustin Pop <iustin@google.com>
parent cdf158a8
......@@ -90,6 +90,8 @@ def WaitForConnected(filename):
def main():
(filename, what) = sys.argv[1:]
Log("Running helper for %s %s", filename, what)
if what == "listen-port":
print WaitForListenPort(filename)
elif what == "connected":
......
......@@ -33,6 +33,11 @@ err() {
}
show_output() {
if [[ -s "$gencert_output" ]]; then
echo
echo 'Generating certificates:'
cat $gencert_output
fi
if [[ -s "$dst_output" ]]; then
echo
echo 'Import output:'
......@@ -74,6 +79,8 @@ upto() {
statusdir=$(mktemp -d)
trap "rm -rf $statusdir" EXIT
gencert_output=$statusdir/gencert.output
src_statusfile=$statusdir/src.status
src_output=$statusdir/src.output
src_x509=$statusdir/src.pem
......@@ -130,6 +137,7 @@ impexpd_helper() {
reset_status() {
rm -f $src_statusfile $dst_output $dst_statusfile $dst_output $dst_portfile
rm -f $gencert_output
}
write_data() {
......@@ -179,9 +187,11 @@ do_import() {
}
upto 'Generate X509 certificates and keys'
impexpd_helper $src_x509 gencert
impexpd_helper $dst_x509 gencert
impexpd_helper $other_x509 gencert
impexpd_helper $src_x509 gencert 2>$gencert_output & srccertpid=$!
impexpd_helper $dst_x509 gencert 2>$gencert_output & dstcertpid=$!
impexpd_helper $other_x509 gencert 2>$gencert_output & othercertpid=$!
checkpids $srccertpid $dstcertpid $othercertpid || \
err 'Failed to generate certificates'
upto 'Normal case'
reset_status
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment