From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from shymkent.ilbers.de ([unix socket]) by shymkent (Cyrus 2.5.10-Debian-2.5.10-3+deb9u2) with LMTPA; Mon, 26 Aug 2024 07:17:59 +0200 X-Sieve: CMU Sieve 2.4 Received: from mail-lf1-f62.google.com (mail-lf1-f62.google.com [209.85.167.62]) by shymkent.ilbers.de (8.15.2/8.15.2/Debian-8+deb9u1) with ESMTPS id 47Q5Hw0F016916 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 26 Aug 2024 07:17:58 +0200 Received: by mail-lf1-f62.google.com with SMTP id 2adb3069b0e04-53347c85199sf2604711e87.1 for ; Sun, 25 Aug 2024 22:17:58 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1724649473; cv=pass; d=google.com; s=arc-20160816; b=S+dRJqeFo+pj4eG8NZxoJ0OrjY8v/rkElRQnPnCICuTnRXWpRzRCDibE59Sf3aZDKM Zud7hy1LWq+XK2uwuorgy1weiRCxRyz8yotxLWyfz5prvqtXyPNAzHiZk5NY1zcnXjOp ua0y4X+6EKPueE7yjyxnC8yKGBOOk6hVKcpEinIjXI3IMMWwnlmjCXq4m4br2mnf7FVH X79iZxHPnH4DE2besuHLdXXdIysMBTJ2u+ipdo7iH0S2Sh0U4mu/ljsW3GbeHN5gwOkE IPrxpVMz2dCeV1R8XfeHeybh3YEGbEkE2XrQu3Jiq21dWfxhZDccXkI3hRRjb6x+P0Dj +3pw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:mime-version:message-id:date :subject:to:from:sender:dkim-signature; bh=twYoP+GbYPOUm6medEW35jtZiWkQGrCVmzm+WIEtTFE=; fh=oDbErlCqqlHqRZ8jBURpXxc5GBkN6blvZbh6e3PCmsI=; b=ekWjNtpRkZsr/3I8I70y++/SYBmzta/wMYaHWkFijVVF24NyB/T4EYkWaf+ljtuGDJ G3zA3wm4yxwV3EHasSqeaM7YxPFMd8uTJkgvWskgXdpu9Zgxh/NbfUHrrWVfz1Vx0/R+ ArFMubS47btKb7qA4RQtgF0TeVKp9I9ppLZEmnYfVljWPYE7mSZ4yk3/M4nmGzl7OpQX 6rYUwj720BWLO8zH2ZqzMBYoNhL352YrtJ6pc2WXBO3B83Gahx+Yp24tRmblavbjQkY6 pGAQg/Mng2PIda8uG8p+5KuM/h/SvF5CeXkPU8hpxW6Ibb2DKsSpKXhkNYFiBpAVQToi 8jXA==; darn=ilbers.de ARC-Authentication-Results: i=2; gmr-mx.google.com; spf=pass (google.com: domain of ubely@ilbers.de designates 85.214.156.166 as permitted sender) smtp.mailfrom=ubely@ilbers.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20230601; t=1724649473; x=1725254273; darn=ilbers.de; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:x-original-authentication-results :x-original-sender:mime-version:message-id:date:subject:to:from :sender:from:to:cc:subject:date:message-id:reply-to; bh=twYoP+GbYPOUm6medEW35jtZiWkQGrCVmzm+WIEtTFE=; b=PveJQIlSBtOYT2XNuAwEgPZXIMB1vLi0Yz93xzc5TWqhHY7Ah42wGfwF5TSgIa2YBJ 0tnfkbN9OTAy1slO2YRaO0kAkO8ESMlaKHvb7oNU6Stjzzw/AC59+cNiCUp14m0khe0D Yx3piCafw91K98TZuN766bE+5eskx7ckaoLf3VjRMWq+PreNeFgNGiTEC1VwS5D7Pbfl YxIFOyXnqL5M8DByLaqi9cmFHvUNc3yTlhluge2KFsT6KyHg/NKFQZ0pUWqV0AfH5Ors ETCOshpGx6pA63GPeyG94zmxU1NN1XUotTn5586wjq6fACoJQ6pRH1gdRgKZOOjXVFF8 RXHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724649473; x=1725254273; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence :x-original-authentication-results:x-original-sender:mime-version :message-id:date:subject:to:from:x-beenthere:x-gm-message-state :sender:from:to:cc:subject:date:message-id:reply-to; bh=twYoP+GbYPOUm6medEW35jtZiWkQGrCVmzm+WIEtTFE=; b=jjdRNcKpIVsQPaccoEbjsqAFNcZcBYwgEGfGYl6GhzrWiq4nVQxaFV7fbaUtxQeRC6 xtXjKfeKZUdgYO/w/aL5Q71Vsy9lfQkbQFVmzTUcgboKpCMhJxKTyJLRo9XN+vpsg8JI wRVhdGwp0eBByuOS9I8tBAjW7s3r2gWMdGS8GawhiWQisVuixmvxdTw9+z5WjOL7DpcF cMcUBY/FRiVtCtfTvFdw7jlFmKf2WI2P+sLH4QJbgyFpih2P4BM8LQIlbrgLBVhOYFNC C54sETFizxkSN29VpPLVFFcdXPxIjlqfBrEAKYvjsuPHIH+By/uSgUqq8aGV+vbfPVOt lbzQ== Sender: isar-users@googlegroups.com X-Forwarded-Encrypted: i=2; AJvYcCUmfl1U2sNWee2u4DQWuJO6bBqPZ98J6OdTHLchd/QYW9GrMb7vgwAZxoz10rCc0uZVnJbN@ilbers.de X-Gm-Message-State: AOJu0YxpjrmRN1VmsDw8D4p11+axdY8kmwD5ZcXtA6/t9G8LCKtjpZYV i225bnOx5KjPveGhMV1dYL5RGyPrZ0o+DmDxkh1ZkUWX2qDMQ64H X-Google-Smtp-Source: AGHT+IHKEArtPprrgrwjWpjoOl5F+lWEg2mqbt0w2BnysmkfU+a2aeMcbWlLYHRq2/TUlKbjaZGLFg== X-Received: by 2002:a2e:b894:0:b0:2f3:f193:d2d0 with SMTP id 38308e7fff4ca-2f4f4937908mr67188331fa.33.1724649471893; Sun, 25 Aug 2024 22:17:51 -0700 (PDT) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a2e:22c6:0:b0:2f3:f220:2807 with SMTP id 38308e7fff4ca-2f402fab7d5ls12250841fa.0.-pod-prod-07-eu; Sun, 25 Aug 2024 22:17:49 -0700 (PDT) X-Received: by 2002:a05:6512:3188:b0:530:ae0a:ab7a with SMTP id 2adb3069b0e04-5343877ab85mr6152986e87.17.1724649468603; Sun, 25 Aug 2024 22:17:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1724649468; cv=none; d=google.com; s=arc-20240605; b=ZOTQFHZHua93YCgEuQZVtHv6MvDxvaLxSmPoyswy+OUaqRjFztyDISNAvTUY8H5gka X6W9HHvdr4cYknLGdgneLKqzn0evyZTr1dAuQKfpCIwaR9NuaNXmaozuGZDxydIUC0N0 unklHfGuFp2zwZp34kjnErRgfZrvaIkSFWyO54XlTjQwanYIsqa4pFlywq4179dtgseb vk9Pssgi99Q7H5YOCG7ww/IA0Wyx1DjxC3pP5MiCOOKTNM4G1DbXqTdGOqWKDupgRg0Y ZIZZLMrlIRKZuyNc8nZluQZ5jUgqpoFXmBnweQnO/JGAT93Ffx03IdVJqVn7o2DO2qFW VW8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from; bh=h0HIkZg+CPkhwvBF9Q85DrY1dsqZw23muJ33Os3uMAg=; fh=7tclEdh7YbwSQowgJ6LNq720O7H5HTEaqj22NJWRE2E=; b=KdZS3JdeZ7uLrZ0iorF8Wmk3tR/d19PL6X38B8OXwCrGm6xzAUZdX3vgStXivhIGbr ivKfzFJRGID2oLeuL5xhcHZDr+wMLlHOZxmHPDF7dHWpEfX187eG/cgCN6OBhevQvKMt gMiOd0UZjM5Xnsiw8k9l/0eok+RzMbPaXqXvW4bbCE1zJKRJwLpdPXG+dLQABS/jEtuf 59IaoSIJLmvJRbnHuesic7El1SsdE7YJP2tn3Fhz//8PwG7LtrBxeokOp20ReARTpUob FVf8/XRVz9GAG9phcjexGVWt47i573/4DaYECX1Qg+mGN5D8p7FTHU1b6duiwGsNuRyp OBAw==; dara=google.com ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of ubely@ilbers.de designates 85.214.156.166 as permitted sender) smtp.mailfrom=ubely@ilbers.de Received: from shymkent.ilbers.de (shymkent.ilbers.de. [85.214.156.166]) by gmr-mx.google.com with ESMTPS id 2adb3069b0e04-5334ea247dfsi182639e87.3.2024.08.25.22.17.48 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 25 Aug 2024 22:17:48 -0700 (PDT) Received-SPF: pass (google.com: domain of ubely@ilbers.de designates 85.214.156.166 as permitted sender) client-ip=85.214.156.166; Received: from hp15.localdomain (44-208-124-178-static.mgts.by [178.124.208.44] (may be forged)) (authenticated bits=0) by shymkent.ilbers.de (8.15.2/8.15.2/Debian-8+deb9u1) with ESMTPSA id 47Q5HkN2016905 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 26 Aug 2024 07:17:47 +0200 From: Uladzimir Bely To: isar-users@googlegroups.com Subject: [PATCH v2] testsuite: cleanup qemu machines left running Date: Mon, 26 Aug 2024 08:15:04 +0300 Message-ID: <20240826051741.624-1-ubely@ilbers.de> X-Mailer: git-send-email 2.44.2 MIME-Version: 1.0 X-Spam-Status: No, score=-4.6 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H2,RCVD_IN_RP_CERTIFIED, RCVD_IN_RP_RNBL,RCVD_IN_RP_SAFE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on shymkent.ilbers.de X-Original-Sender: ubely@ilbers.de X-Original-Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of ubely@ilbers.de designates 85.214.156.166 as permitted sender) smtp.mailfrom=ubely@ilbers.de Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list isar-users@googlegroups.com; contact isar-users+owners@googlegroups.com List-ID: X-Spam-Checked-In-Group: isar-users@googlegroups.com X-Google-Group-Id: 914930254986 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , X-TUID: cQUs3R7sYuj/ Parameter "keep=True" in `vm_start` function allows to share the same qemu process between different tests. In case the machine is forgotten to be closed by the last test or in case avocado skips some tests (due to internal error or other reason) such qemu processes stay running after the testsuite completed. This change allows to terminate these processes. Signed-off-by: Uladzimir Bely --- scripts/ci_build.sh | 9 ++++++++- testsuite/cleanup.py | 26 ++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) create mode 100755 testsuite/cleanup.py Changes since v1: - Preserve avocado return code on exiting ci_build.sh. diff --git a/scripts/ci_build.sh b/scripts/ci_build.sh index 0aa2403d..338557ad 100755 --- a/scripts/ci_build.sh +++ b/scripts/ci_build.sh @@ -142,9 +142,16 @@ logs_dir = $(realpath "${BASE_DIR}")/job-results EOF export VIRTUAL_ENV="./" +ret=0 + # the real stuff starts here, trace commands from now on set -x avocado ${VERBOSE} run "${TESTSUITE_DIR}/citest.py" \ -t "${TAGS}" --max-parallel-tasks=1 --disable-sysinfo \ - ${SSTATE} ${TIMEOUT} + ${SSTATE} ${TIMEOUT} \ + || ret=$? + +python3 ${TESTSUITE_DIR}/cleanup.py + +exit ${ret} diff --git a/testsuite/cleanup.py b/testsuite/cleanup.py new file mode 100755 index 00000000..c81397d2 --- /dev/null +++ b/testsuite/cleanup.py @@ -0,0 +1,26 @@ +#!/usr/bin/env python3 + +import os +import pickle +import signal + +build_dir = os.path.join(os.path.dirname(__file__), '..', 'build') + +vm_dict_file = f"{build_dir}/vm_dict_file" +vm_dict = {} + +if os.path.isfile(vm_dict_file): + with open(vm_dict_file, 'rb') as f: + data = f.read() + if data: + vm_dict = pickle.loads(data) + +for vm in vm_dict: + pid = vm_dict[vm][0] + name = vm_dict[vm][1][0] + print(f"Killing {name} process with pid {pid}", end ="... ") + try: + os.kill(pid, signal.SIGKILL) + print("OK") + except ProcessLookupError: + print("Not found") -- 2.44.2 -- You received this message because you are subscribed to the Google Groups "isar-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to isar-users+unsubscribe@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/isar-users/20240826051741.624-1-ubely%40ilbers.de.