From patchwork Mon Jan 6 21:05:51 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Giacomo Leidi X-Patchwork-Id: 36691 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 49C5927BBE9; Mon, 6 Jan 2025 21:07:33 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-6.4 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE, SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 659AB27BBE2 for ; Mon, 6 Jan 2025 21:07:31 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tUuJV-0004ll-OF; Mon, 06 Jan 2025 16:07:06 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tUuJT-0004l6-A4 for guix-patches@gnu.org; Mon, 06 Jan 2025 16:07:03 -0500 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tUuJT-0001hC-1u for guix-patches@gnu.org; Mon, 06 Jan 2025 16:07:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:From:To:In-Reply-To:References:Subject; bh=pYfku+eEOO9PGafJfDc32HFq0ch6tsW+NRAT0IU6zg0=; b=ZlzutWayyYrCpPT4+m9rjiZbDLynse5QMeE+Qrla1wSeJlTd+7ElW/vxy4ZEnNDP2XJGUlczunaMABb+NtnAJEzK5L8LJv5M3yTohaEyKdi5OfgQ0QrmwVynOY+y6XHtuBYAlwTFgd3h8BoQxu8PKyhoEPUoTcmte3MuGYl+5PLyIaBupPAVUt0Zj2oOuPMmTrQ7bst+9LmJHUb3L6fiYCJVL/AyJz/xS3AT66nw5drPqJ1v0s2B/z9Qk2tp9s1BMzKdkyuTgRmdVqpd/V8ECMfArjQqyi+tjDKV1NymY2RmA24kEogeebdOYdKYyZp4XCV7GjZeASEiMXcKE3/1VQ==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tUuJS-0003E0-Rz for guix-patches@gnu.org; Mon, 06 Jan 2025 16:07:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#75203] [PATCH v2 1/2] services: tests: Add delay for rootless Podman system test. References: <1881b153-9191-4322-8c71-195b5eef5651@autistici.org> In-Reply-To: <1881b153-9191-4322-8c71-195b5eef5651@autistici.org> Resent-From: Giacomo Leidi Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 06 Jan 2025 21:07:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 75203 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: To: 75203@debbugs.gnu.org Cc: Giacomo Leidi Received: via spool by 75203-submit@debbugs.gnu.org id=B75203.173619757312279 (code B ref 75203); Mon, 06 Jan 2025 21:07:02 +0000 Received: (at 75203) by debbugs.gnu.org; 6 Jan 2025 21:06:13 +0000 Received: from localhost ([127.0.0.1]:40655 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tUuIe-0003Bn-7p for submit@debbugs.gnu.org; Mon, 06 Jan 2025 16:06:12 -0500 Received: from confino.investici.org ([93.190.126.19]:44895) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tUuIc-0003Be-Se for 75203@debbugs.gnu.org; Mon, 06 Jan 2025 16:06:11 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=autistici.org; s=stigmate; t=1736197569; bh=pYfku+eEOO9PGafJfDc32HFq0ch6tsW+NRAT0IU6zg0=; h=From:To:Cc:Subject:Date:From; b=tzy5GXXoUzAFjZH9TcYMS5Mdhmelgzh0guQHJq5YQUM7jnJevnRJUyT60q/S7P8ef gkWnxi5L4gEN5hqL6jtiGAdK4EFTkvoekzt9/EW3ja3XjC5n7aQU8C8l7P+xJC/fa6 AoyWT9eVRgflnaVx8LYCim6NXP6Jf6SI0PPn+2jQ= Received: from mx1.investici.org (unknown [127.0.0.1]) by confino.investici.org (Postfix) with ESMTP id 4YRmtn3KpGz10wr; Mon, 6 Jan 2025 21:06:09 +0000 (UTC) Received: from [93.190.126.19] (mx1.investici.org [93.190.126.19]) (Authenticated sender: goodoldpaul@autistici.org) by localhost (Postfix) with ESMTPSA id 4YRmtn2KtWz10x3; Mon, 6 Jan 2025 21:06:08 +0000 (UTC) Date: Mon, 6 Jan 2025 22:05:51 +0100 Message-ID: X-Mailer: git-send-email 2.47.1 MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: Giacomo Leidi X-ACL-Warn: , Giacomo Leidi via Guix-patches X-Patchwork-Original-From: Giacomo Leidi via Guix-patches via From: Giacomo Leidi Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * gnu/tests/containers.scm (run-rootless-podman-test): Add 60 seconds long delay before tests are actually run. Change-Id: Ifcf70f7258f9e0886bf829884d7daedc9803352b --- gnu/tests/containers.scm | 113 +++++++++++++++++++++------------------ 1 file changed, 60 insertions(+), 53 deletions(-) base-commit: ee3673217b82d50e97434ae85145b8d68f077446 diff --git a/gnu/tests/containers.scm b/gnu/tests/containers.scm index ba2fb22df6..69cd311c82 100644 --- a/gnu/tests/containers.scm +++ b/gnu/tests/containers.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2024 Giacomo Leidi +;;; Copyright © 2024, 2025 Giacomo Leidi ;;; ;;; This file is part of GNU Guix. ;;; @@ -97,17 +97,65 @@ (define (run-rootless-podman-test oci-tarball) (test-runner-current (system-test-runner #$output)) (test-begin "rootless-podman") - - (test-assert "service started" - (marionette-eval - '(begin - (use-modules (gnu services herd)) - (match (start-service 'cgroups2-fs-owner) - (#f #f) - ;; herd returns (running #f), likely because of one shot, - ;; so consider any non-error a success. - (('service response-parts ...) #t))) - marionette)) + (marionette-eval + '(begin + (use-modules (gnu services herd)) + (wait-for-service 'file-system-/sys/fs/cgroup)) + marionette) + + (test-assert "services started successfully and /sys/fs/cgroup has correct permissions" + (begin + (define (run-test) + (marionette-eval + `(begin + (use-modules (ice-9 popen) + (ice-9 match) + (ice-9 rdelim)) + + (define (read-lines file-or-port) + (define (loop-lines port) + (let loop ((lines '())) + (match (read-line port) + ((? eof-object?) + (reverse lines)) + (line + (loop (cons line lines)))))) + + (if (port? file-or-port) + (loop-lines file-or-port) + (call-with-input-file file-or-port + loop-lines))) + + (define slurp + (lambda args + (let* ((port (apply open-pipe* OPEN_READ args)) + (output (read-lines port)) + (status (close-pipe port))) + output))) + (let* ((bash + ,(string-append #$bash "/bin/bash")) + (response1 + (slurp bash "-c" + (string-append "ls -la /sys/fs/cgroup | " + "grep -E ' \\./?$' | awk '{ print $4 }'"))) + (response2 (slurp bash "-c" + (string-append "ls -l /sys/fs/cgroup/cgroup" + ".{procs,subtree_control,threads} | " + "awk '{ print $4 }' | sort -u")))) + (list (string-join response1 "\n") (string-join response2 "\n")))) + marionette)) + ;; Allow services to come up on slower machines + (let loop ((attempts 0)) + (if (= attempts 60) + (error "Services didn't come up after more than 60 seconds") + (if (equal? '("cgroup" "cgroup") + (run-test)) + #t + (begin + (sleep 1) + (format #t "Services didn't come up yet, retrying with attempt ~a~%" + (+ 1 attempts)) + (loop (+ 1 attempts)))))))) (test-equal "/sys/fs/cgroup/cgroup.subtree_control content is sound" (list "cpu" "cpuset" "memory" "pids") @@ -144,47 +192,6 @@ (define (run-rootless-podman-test oci-tarball) (sort-list (string-split (first response1) #\space) string