From owner-svn-src-user@freebsd.org  Wed Dec 21 09:59:56 2016
Return-Path: <owner-svn-src-user@freebsd.org>
Delivered-To: svn-src-user@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org
 [IPv6:2001:1900:2254:206a::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 557C1C89108
 for <svn-src-user@mailman.ysv.freebsd.org>;
 Wed, 21 Dec 2016 09:59:56 +0000 (UTC) (envelope-from pho@FreeBSD.org)
Received: from repo.freebsd.org (repo.freebsd.org
 [IPv6:2610:1c1:1:6068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id 234A612EF;
 Wed, 21 Dec 2016 09:59:56 +0000 (UTC) (envelope-from pho@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBL9xt3o078074;
 Wed, 21 Dec 2016 09:59:55 GMT (envelope-from pho@FreeBSD.org)
Received: (from pho@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBL9xtes078073;
 Wed, 21 Dec 2016 09:59:55 GMT (envelope-from pho@FreeBSD.org)
Message-Id: <201612210959.uBL9xtes078073@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: pho set sender to pho@FreeBSD.org
 using -f
From: Peter Holm <pho@FreeBSD.org>
Date: Wed, 21 Dec 2016 09:59:55 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
Subject: svn commit: r310362 - user/pho/stress2/misc
X-SVN-Group: user
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-user@freebsd.org
X-Mailman-Version: 2.1.23
Precedence: list
List-Id: "SVN commit messages for the experimental &quot; user&quot;
 src tree" <svn-src-user.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-user>,
 <mailto:svn-src-user-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-user/>
List-Post: <mailto:svn-src-user@freebsd.org>
List-Help: <mailto:svn-src-user-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-user>,
 <mailto:svn-src-user-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Wed, 21 Dec 2016 09:59:56 -0000

Author: pho
Date: Wed Dec 21 09:59:55 2016
New Revision: 310362
URL: https://svnweb.freebsd.org/changeset/base/310362

Log:
  Added a regression test.
  
  PR:		214923
  Submitted by:	Jihyun Yu <yjh0502@gmail.com>
  Sponsored by:	Dell EMC Isilon

Added:
  user/pho/stress2/misc/watchman.sh   (contents, props changed)

Added: user/pho/stress2/misc/watchman.sh
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ user/pho/stress2/misc/watchman.sh	Wed Dec 21 09:59:55 2016	(r310362)
@@ -0,0 +1,43 @@
+#!/bin/sh
+
+# Bug 214923 - kqueue hangs with busy loop
+# Test scenario by: Jihyun Yu <yjh0502@gmail.com>
+
+# https://people.freebsd.org/~pho/stress/log/watchman.txt
+# Fixed by: r310302
+
+. ../default.cfg
+
+[ -z `which watchman` ] && { echo "watchman is not installed"; exit 0; }
+
+daemon sh -c "(cd ../testcases/swap; ./swap -t 5m -i 20 -h -l 100)" > \
+    /dev/null
+
+dir=/tmp/watchman
+rm -rf $dir
+mkdir -p $dir
+cd $dir
+
+mkdir -p foo bar
+seq -w 0 100 | xargs -n1 -I{} touch foo/{}.c
+
+echo '["subscribe","./","mysub",{"fields":["name"],"expression":["allof",'\
+    '["type","f"],["not","empty"],["suffix","c"]]}]' | \
+    watchman -p -j --server-encoding=json > /dev/null &
+pids=$!
+while true; do find bar/ -type f | xargs -n1 -P5 -I'{}' mv '{}' foo; done &
+pids="$pids $!"
+while true; do find foo/ -type f | xargs -n1 -P5 -I'{}' mv '{}' bar; done &
+pids="$pids $!"
+
+sleep 180
+while pgrep -q swap; do
+	pkill -9 swap
+done
+kill -9 $pids
+pkill watchman
+wait
+cd /
+sleep 1
+rm -rf $dir
+exit 0