[PATCH] tests: remove seemingly unnecessary "sleep 3"

Jeff Darcy jdarcy at redhat.com
Wed Oct 6 14:01:22 UTC 2010


On 10/06/2010 09:44 AM, Jim Meyering wrote:
> Could it have failed with ENOTEMPTY rather than EPERM?
> It's not easy (maybe not even possible) to make "rm -rf" fail with
> EPERM when all of the things being deleted were created by the same
> user running the command.

The error message is "operation not permitted" which maps to EPERM.
ENOTEMPTY would make more sense to me too, it's pretty clearly the
actual reason for the failure, but it's not what the logs were showing.

> If you can reproduce that, I'd be very interested in any
> details you can provide, since init.sh is used in many projects,
> and I'm about to make a coreutils release that includes it.

I'll run it under strace and verify the actual errno.

>> If/when I can test that version on my machine and not have it report
>> errors after all tests have passed, then yes.  Also, whatever fix we
>> decide on also needs to be applied to other tests.
> 
> Of course.
> 
> Here's a patch that does that:

Looks fine, but I'd like a chance to test it at least a few times before
I ACK and we both have a meeting right now.

> From d906ff6097995029d308970118d145b0408c52ff Mon Sep 17 00:00:00 2001
> From: Jim Meyering <meyering at redhat.com>
> Date: Wed, 6 Oct 2010 10:15:54 +0200
> Subject: [PATCH] tests: remove seemingly unnecessary "sleep 3"
> 
> * t/replication (cleanup_): Don't sleep for 3 seconds.
> * t/replication (cleanup_): Kill with -9, to avoid diagnostics
> from init.sh's cleanup (rm -rf) process when it takes too long
> for mongod to handle the signal.
> * t/basic (cleanup_): Likewise.
> ---
>  t/basic       |    4 ++--
>  t/replication |    6 +++---
>  2 files changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/t/basic b/t/basic
> index 4170568..17a0c62 100644
> --- a/t/basic
> +++ b/t/basic
> @@ -9,7 +9,7 @@ m_port=$(expr $mongo_base_port + 0)
> 
>  mongod --port $m_port --pidfilepath mongod/pid --dbpath mongod > mongod.log 2>&1 &
>  mongo_pid=$!
> -cleanup_() { kill $mongo_pid; }
> +cleanup_() { kill -9 $mongo_pid; }
> 
>  # Wait for up to 3 seconds for mongod to begin listening.
>  wait_for .1 30 'mongo < /dev/null' \
> @@ -123,7 +123,7 @@ printf '[{"path": "FS", "type": "fs", "name": "primary"}]\n' \
> 
>  iwhd -v -p $port -c iwhd.cfg -d localhost:$m_port &
>  iwhd_pid=$!
> -cleanup_() { kill $mongo_pid $iwhd_pid; }
> +cleanup_() { kill -9 $mongo_pid $iwhd_pid; }
> 
>  # Wait for up to 3 seconds for iwhd to begin listening on $port.
>  wait_for .1 30 "curl -s http://localhost:$port" \
> diff --git a/t/replication b/t/replication
> index 9ce8ab2..429a30b 100644
> --- a/t/replication
> +++ b/t/replication
> @@ -9,7 +9,7 @@ m_port=$(expr $mongo_base_port + 1)
> 
>  mongod --port $m_port --pidfilepath mongod/pid --dbpath mongod > mongod.log 2>&1 &
>  mongo_pid=$!
> -cleanup_() { kill $mongo_pid; sleep 3; }
> +cleanup_() { kill -9 $mongo_pid; }
> 
>  # Wait for up to 3 seconds for mongod to begin listening.
>  wait_for .1 30 'mongo < /dev/null' \
> @@ -28,7 +28,7 @@ iwhd -v -p $port -c iwhd_u.cfg -d localhost:$m_port &
>  iwhd_pid=$!
>  wait_for .1 30 "curl http://localhost:$port" \
>  	|| framework_failure_ "iwhd upstream"
> -cleanup_() { kill $mongo_pid $iwhd_pid; sleep 3; }
> +cleanup_() { kill -9 $mongo_pid $iwhd_pid; }
> 
>  cat > iwhd_d.cfg << EOF
>  [
> @@ -41,7 +41,7 @@ iwhd -v -p $d_port -c iwhd_d.cfg -d localhost:$m_port &
>  iwhd_d_pid=$!
>  wait_for .1 30 "curl http://localhost:$d_port" \
>  	|| framework_failure_ "iwhd downstream"
> -cleanup_() { kill $mongo_pid $iwhd_pid $iwhd_d_pid; sleep 3; }
> +cleanup_() { kill -9 $mongo_pid $iwhd_pid $iwhd_d_pid; }
> 
>  api=http://localhost:$port
>  wait_for_repl() {
> --
> 1.7.3.1.50.g1e633


More information about the iwhd-devel mailing list