Package: at
Version: 3.2.5-2.1
Severity: normal
Tags: patch


Hi

I'd like to submit a patch for the at package that fixes a failing test
in basic-usage.sh. You can see the failure here:
https://ci.debian.net/packages/a/at/unstable/amd64/

The failure occurs because atd is not running during the test.
This patch ensures that atd is started if it is not already running.

With this patch, it work as:

# autopkgtest . -- null
...
autopkgtest [08:33:23]: test basic-usage: [-----------------------
+ TMPFILE=at.6100
++ mktemp -d
+ WORKDIR=/tmp/tmp.fShD57rogs
+ trap 'rm -rf /tmp/tmp.fShD57rogs' 0 INT QUIT ABRT PIPE TERM
++ ps aux
++ grep -wq '[a]td'
+ trap 'rm -rf /tmp/tmp.fShD57rogs; pkill -9 atd' 0 INT QUIT ABRT PIPE TERM
+ atd
++ atq
++ wc -l
+ JOBS_BEFORE=0
+ at now + 1 minute
++ date
warning: commands will be executed using /bin/sh
+ echo 'echo Sat Apr 12 08:33:23 UTC 2025 > /tmp/tmp.fShD57rogs/at.6100'
job 78 at Sat Apr 12 08:34:00 2025
+ sleep 2
+ test -f at.6100
+ echo 'OK, at.6100 doesn'\''t exist yet; expected..'
OK, at.6100 doesn't exist yet; expected..
++ atq
++ wc -l
+ JOBS_AFTER=1
+ [[ 1 -eq 1 ]]
+ echo 'OK, 1 new queued job exists..'
OK, 1 new queued job exists..
+ sleep 60
+ grep -Fq UTC /tmp/tmp.fShD57rogs/at.6100
OK, at.6100 exists and everything looks in order..
+ echo 'OK, at.6100 exists and everything looks in order..'
OK; PASS.
+ echo 'OK; PASS.'
+ rm -rf /tmp/tmp.fShD57rogs
+ pkill -9 atd
autopkgtest [08:34:25]: test basic-usage: -----------------------]
autopkgtest [08:34:25]: test basic-usage:  - - - - - - - - - - results - - - - - - - - - -
basic-usage          PASS
autopkgtest [08:34:25]: @@@@@@@@@@@@@@@@@@@@ summary
basic-usage          PASS
autopkgtest [08:34:25]: Binaries: resetting testbed apt configuration
Hit:1 http://deb.debian.org/debian unstable InRelease
Reading package lists..


# ./debian/tests/basic-usage
+ TMPFILE=at.12814
++ mktemp -d
+ WORKDIR=/tmp/tmp.rgFaEVT0wz
+ trap 'rm -rf /tmp/tmp.rgFaEVT0wz' 0 INT QUIT ABRT PIPE TERM
++ ps aux
++ grep -wq '[a]td'
+ trap 'rm -rf /tmp/tmp.rgFaEVT0wz; pkill -9 atd' 0 INT QUIT ABRT PIPE TERM
+ atd
++ atq
++ wc -l
+ JOBS_BEFORE=0
+ at now + 1 minute
++ date
warning: commands will be executed using /bin/sh
+ echo 'echo Sat Apr 12 08:35:30 UTC 2025 > /tmp/tmp.rgFaEVT0wz/at.12814'
job 79 at Sat Apr 12 08:36:00 2025
+ sleep 2
+ test -f at.12814
+ echo 'OK, at.12814 doesn'\''t exist yet; expected..'
OK, at.12814 doesn't exist yet; expected..
++ atq
++ wc -l
+ JOBS_AFTER=1
+ [[ 1 -eq 1 ]]
+ echo 'OK, 1 new queued job exists..'
OK, 1 new queued job exists..
+ sleep 60
+ grep -Fq UTC /tmp/tmp.rgFaEVT0wz/at.12814
+ echo 'OK, at.12814 exists and everything looks in order..'
OK, at.12814 exists and everything looks in order..
+ echo 'OK; PASS.'
OK; PASS.
+ rm -rf /tmp/tmp.rgFaEVT0wz
+ pkill -9 atd


I have attached the patch for your review. Please check it
and let me know if there are any issues, thanks.
From 7fc81a0f859acf10aeea293efe3cff7b294a1f55 Mon Sep 17 00:00:00 2001
From: Wenlin Kang <wenlin.k...@windriver.com>
Date: Sat, 12 Apr 2025 14:39:11 +0800
Subject: [PATCH] basic-usage: Fix failure due to atd not running

The basic-usage test fails because atd is not running. This fix
ensures that atd is started if it is not already running.

Signed-off-by: Wenlin Kang <wenlin.k...@windriver.com>
---
 debian/tests/basic-usage | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/debian/tests/basic-usage b/debian/tests/basic-usage
index 3872964..0256a00 100755
--- a/debian/tests/basic-usage
+++ b/debian/tests/basic-usage
@@ -17,6 +17,14 @@ TMPFILE=at.$RANDOM
 WORKDIR=$(mktemp -d)
 trap "rm -rf $WORKDIR" 0 INT QUIT ABRT PIPE TERM
 
+# make sure atd is running
+if ! `ps aux  | grep -wq '[a]td'`; then
+	trap "rm -rf $WORKDIR; pkill -9 atd" 0 INT QUIT ABRT PIPE TERM
+	atd
+	# ensure expired tasks are not left in the queue when atq is run
+	sleep 1
+fi
+
 JOBS_BEFORE=$(atq | wc -l)
 
 # use at command to schedule a job.
-- 
2.43.0

Reply via email to