summaryrefslogtreecommitdiff
path: root/etc
diff options
context:
space:
mode:
authorAkim Demaille <akim.demaille@gmail.com>2020-04-25 11:34:06 +0200
committerAkim Demaille <akim.demaille@gmail.com>2020-04-25 11:34:06 +0200
commit3ab12c1036812ef855385c947598284241f746b1 (patch)
tree9120ac9946b64e6b3829f9aa96c0c84228e88efc /etc
parent30ce43b2b5384c6cb96a100942d996b40ac95599 (diff)
downloadbison-3ab12c1036812ef855385c947598284241f746b1.tar.gz
bench: store in benches/012 rather than in benches/12
* etc/bench.pl.in ($basedir): New. Format $count with a least three digits.
Diffstat (limited to 'etc')
-rwxr-xr-xetc/bench.pl.in29
1 files changed, 18 insertions, 11 deletions
diff --git a/etc/bench.pl.in b/etc/bench.pl.in
index 1498dd6f..96299939 100755
--- a/etc/bench.pl.in
+++ b/etc/bench.pl.in
@@ -1163,19 +1163,26 @@ sub getopt ()
getopt;
+my $basedir = 'benches';
+
# Create the directory we work in.
-mkdir "benches" or die "cannot create benches"
- unless -d "benches";
-my $count = 1;
-++$count
- while -d "benches/$count";
-my $dir = "benches/$count";
+mkdir $basedir or die "cannot create directory $basedir"
+ unless -d $basedir;
+
+my $count = 0;
+my $dir;
+while (!$dir || -d $dir)
+{
+ ++$count;
+ $dir = sprintf "%s/%03d", $basedir, $count;
+}
mkdir $dir
- or die "cannot create $dir";
-unlink "benches/latest"
- or die "cannot unlink benches/latest"
- if -l "benches/latest";
-symlink $count, "benches/latest"
+ or die "cannot create directory $dir";
+
+unlink "$basedir/latest"
+ or die "cannot unlink $basedir/latest"
+ if -l "$basedir/latest";
+symlink sprintf("%03d", $count), "$basedir/latest"
or die "cannot create symlink";
chdir $dir
or die "cannot chdir $dir";