From: Chip Turner Date: Tue, 23 Dec 2014 18:40:17 +0000 (-0800) Subject: Fix incorrect 'test' statement in unit test X-Git-Tag: v0.22.0~72 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=b61dfbebfb3c125bc5b7e4cc235ab2ea8bfb5086;p=folly.git Fix incorrect 'test' statement in unit test Summary: The 'test' command uses one equal sign for string equality, not two. bash apparently is okay with two, but zsh isn't, causing this test to pass if your shell was bash and fail if it was zsh. The test now passes with bash, bash in sh mode, zsh, and even dash. Test Plan: runtests, also, these pass (zsh failed before): SHELL=/bin/bash _build/dbg/folly/test/subprocess_test SHELL=/bin/sh _build/dbg/folly/test/subprocess_test SHELL=/bin/zsh _build/dbg/folly/test/subprocess_test SHELL=/bin/dash _build/dbg/folly/test/subprocess_test Reviewed By: njormrod@fb.com Subscribers: lins, anca, folly-diffs@ FB internal diff: D1756090 Signature: t1:1756090:1419360674:8576e61a6e0ee102612c5eae0e1fbd79cc397bfa --- diff --git a/folly/test/SubprocessTest.cpp b/folly/test/SubprocessTest.cpp index 452b8626..d883c765 100644 --- a/folly/test/SubprocessTest.cpp +++ b/folly/test/SubprocessTest.cpp @@ -257,7 +257,7 @@ TEST(CommunicateSubprocessTest, Duplex) { } TEST(CommunicateSubprocessTest, ProcessGroupLeader) { - const auto testIsLeader = "test $(cut -d ' ' -f 5 /proc/$$/stat) == $$"; + const auto testIsLeader = "test $(cut -d ' ' -f 5 /proc/$$/stat) = $$"; Subprocess nonLeader(testIsLeader); EXPECT_THROW(nonLeader.waitChecked(), CalledProcessError); Subprocess leader(testIsLeader, Subprocess::Options().processGroupLeader());