| 49 | |
| 50 | |
| 51 | TEST(dmclock_server, bad_tag_deathtest) { |
| 52 | using ClientId = int; |
| 53 | using Queue = dmc::PullPriorityQueue<ClientId,Request,true>; |
| 54 | using QueueRef = std::unique_ptr<Queue>; |
| 55 | |
| 56 | ClientId client1 = 17; |
| 57 | ClientId client2 = 18; |
| 58 | |
| 59 | double reservation = 0.0; |
| 60 | double weight = 0.0; |
| 61 | |
| 62 | dmc::ClientInfo ci1(reservation, weight, 0.0); |
| 63 | dmc::ClientInfo ci2(reservation, weight, 1.0); |
| 64 | |
| 65 | auto client_info_f = [&] (ClientId c) -> const dmc::ClientInfo* { |
| 66 | if (client1 == c) return &ci1; |
| 67 | else if (client2 == c) return &ci2; |
| 68 | else { |
| 69 | ADD_FAILURE() << "got request from neither of two clients"; |
| 70 | return nullptr; |
| 71 | } |
| 72 | }; |
| 73 | |
| 74 | QueueRef pq(new Queue(client_info_f, AtLimit::Wait)); |
| 75 | ReqParams req_params(1,1); |
| 76 | |
| 77 | // Disable coredumps |
| 78 | PrCtl unset_dumpable; |
| 79 | |
| 80 | EXPECT_DEATH_IF_SUPPORTED(pq->add_request(Request{}, client1, req_params), |
| 81 | "Assertion.*reservation.*max_tag.*" |
| 82 | "proportion.*max_tag") << |
| 83 | "we should fail if a client tries to generate a reservation tag " |
| 84 | "where reservation and proportion are both 0"; |
| 85 | |
| 86 | |
| 87 | EXPECT_DEATH_IF_SUPPORTED(pq->add_request(Request{}, client2, req_params), |
| 88 | "Assertion.*reservation.*max_tag.*" |
| 89 | "proportion.*max_tag") << |
| 90 | "we should fail if a client tries to generate a reservation tag " |
| 91 | "where reservation and proportion are both 0"; |
| 92 | |
| 93 | EXPECT_DEATH_IF_SUPPORTED(Queue(client_info_f, AtLimit::Reject), |
| 94 | "Assertion.*Reject.*Delayed") << |
| 95 | "we should fail if a client tries to construct a queue with both " |
| 96 | "DelayedTagCalc and AtLimit::Reject"; |
| 97 | } |
| 98 | |
| 99 | |
| 100 | TEST(dmclock_server, client_idle_erase) { |
nothing calls this directly
no test coverage detected