#!/bin/sh
# ensure that "rm -rf DIR-with-many-entries" is not O(N^2)
-# Copyright (C) 2008 Free Software Foundation, Inc.
+# Copyright (C) 2008-2009 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
setup_duration=$(expr $(date +%s) - $start)
echo creating a $n-entry directory took $setup_duration seconds
+# If set-up took longer than the default $threshold_seconds,
+# use the longer set-up duration as the limit.
+test $threshold_seconds -lt $setup_duration \
+ threshold_seconds=$setup_duration
+
fail=0
start=$(date +%s)
timeout ${threshold_seconds}s rm -rf d; err=$?