#!/bin/sh

# FIXME: use flock.pl to test Parp::Locking

perl -MFcntl=:flock -wle '
  $file = sprintf "/tmp/%d.%d", time() + 1, $$+2;
  open(F, ">$file") or die $!;
  flock(F, LOCK_EX);
  sleep 2;
  unlink $file;
' &

sleep 1

if ./parp-inject /tmp; then
  echo 'If this always gets printed on a machine with no load,'
  echo 'something is broken.'
else
  echo 'flocking works OK'.
fi

