cl/428950751: Fix intermittent failures in various unit tests in AgentTest.
cl/428950751: Fix intermittent failures in various unit tests in AgentTest.

The root cause is an unintended side-effect of go/kcl/466292 which now defers
enclave destruction to a CFS task. Thus enclave destruction of a prior test
can now race with enclave creation of the next one.

The fix is to retry assignment of CPUs to a enclave a finite number of times
as long as the reason for failure is consistent with the race described above.

[ RUN      ] AgentTest.MsgCpuNotIdle
[       OK ] AgentTest.MsgCpuNotIdle (130 ms)
[ RUN      ] AgentTest.SetSched
third_party/ghost/lib/enclave.cc:433(2067) CHECK FAILED: write(cpumask_fd, cpumask.c_str(), cpumask.length()) == cpumask.length() [-1 != 1]
errno: 16 [Device or resource busy]
PID 2067 Backtrace:
[0] 0x55a0c56c3645 : ghost::Exit()
[1] 0x55a0c569864a : ghost::LocalEnclave::CreateAndAttachToEnclave()
[2] 0x55a0c569987a : ghost::LocalEnclave::LocalEnclave()
[3] 0x55a0c568e85e : ghost::(anonymous namespace)::AgentTest_SetSched_Test::TestBody()
[4] 0x55a0c56d3728 : testing::Test::Run()
[5] 0x55a0c56d4598 : testing::TestInfo::Run()
[6] 0x55a0c56d52a2 : testing::TestSuite::Run()
[7] 0x55a0c56e672f : testing::internal::UnitTestImpl::RunAllTests()
[8] 0x55a0c56e5907 : testing::UnitTest::Run()
[9] 0x55a0c56c8e3d : main
[10] 0x7f266772c8d3 : __libc_start_main
[11] 0x55a0c567a8aa : _start

Reported by: jhumphri@

TESTED=over 100 iterations of agent_test without failure

google/ghost-userspace,google/ghost-userspace,google/ghost-userspace,google/ghost-userspace