a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březina Pavel Březina <pbrezina@redhat.com>
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březina Copyright (C) 2014 Red Hat
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březina This program is free software; you can redistribute it and/or modify
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březina it under the terms of the GNU General Public License as published by
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březina the Free Software Foundation; either version 3 of the License, or
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březina (at your option) any later version.
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březina This program is distributed in the hope that it will be useful,
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březina but WITHOUT ANY WARRANTY; without even the implied warranty of
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březina MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březina GNU General Public License for more details.
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březina You should have received a copy of the GNU General Public License
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březina along with this program. If not, see <http://www.gnu.org/licenses/>.
4e5e846de22407f825fe3b4040d79606818a2419Jakub Hrozek cmocka_unit_test_setup_teardown(test_ ## test, test_setup, test_teardown)
5d69dd4d62dab877dfc3c88e410816034981915fPavel Březina test_ctx->be_ctx->offstat.went_offline = get_current_time(); \
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březina/* Since both test_ctx->done and ptask->req is marked as finished already
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březina * in the sync _send function before a new execution is scheduled we need to
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březina * rely on the fact that ptask->req is set to zero when a new timer is
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březina * created. This way we guarantee that the condition is true only when
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březina * the ptask is executed and a new one is scheduled. */
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březina#define is_sync_ptask_finished(test_ctx, ptask) \
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březina/* Mock few backend functions so we don't have to bring the whole
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březina * data provider into this test. */
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březina test_ctx = sss_mock_ptr_type(struct test_ctx *);
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březina test_ctx = sss_mock_ptr_type(struct test_ctx *);
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březinastruct tevent_req * test_be_ptask_send(TALLOC_CTX *mem_ctx,
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březina test_ctx = talloc_get_type(pvt, struct test_ctx);
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březina req = tevent_req_create(mem_ctx, &state, struct test_be_ptask_state);
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březinastruct tevent_req * test_be_ptask_null_send(TALLOC_CTX *mem_ctx,
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březina test_ctx = talloc_get_type(pvt, struct test_ctx);
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březinastruct tevent_req * test_be_ptask_timeout_send(TALLOC_CTX *mem_ctx,
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březina test_ctx = talloc_get_type(pvt, struct test_ctx);
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březina req = tevent_req_create(mem_ctx, &state, struct test_be_ptask_state);
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březina /* we won't finish the request */
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březinaerrno_t test_be_ptask_recv(struct tevent_req *req)
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březina state = tevent_req_data(req, struct test_be_ptask_state);
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březinaerrno_t test_be_ptask_error_recv(struct tevent_req *req)
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březina state = tevent_req_data(req, struct test_be_ptask_state);
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březinaerrno_t test_be_ptask_sync(TALLOC_CTX *mem_ctx,
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březina test_ctx = talloc_get_type(pvt, struct test_ctx);
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březinaerrno_t test_be_ptask_sync_error(TALLOC_CTX *mem_ctx,
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březina test_ctx = talloc_get_type(pvt, struct test_ctx);
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březina test_ctx = talloc_zero(global_talloc_context, struct test_ctx);
d43c9d18fb263b1ea4071b20e93ce4994583f62fJakub Hrozek test_ctx->be_ctx = mock_be_ctx(test_ctx, test_ctx->tctx);
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březina test_ctx->be_ctx->ev = tevent_context_init(test_ctx->be_ctx);
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březinavoid test_be_ptask_create_einval_be(void **state)
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březina struct test_ctx *test_ctx = (struct test_ctx *)(*state);
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březina ret = be_ptask_create(test_ctx, NULL, PERIOD, 0, 0, 0, 0,
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březina test_be_ptask_recv, NULL, "Test ptask", &ptask);
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březinavoid test_be_ptask_create_einval_period(void **state)
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březina struct test_ctx *test_ctx = (struct test_ctx *)(*state);
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březina ret = be_ptask_create(test_ctx, test_ctx->be_ctx, 0, 0, 0, 0, 0,
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březina test_be_ptask_recv, NULL, "Test ptask", &ptask);
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březinavoid test_be_ptask_create_einval_send(void **state)
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březina struct test_ctx *test_ctx = (struct test_ctx *)(*state);
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březina ret = be_ptask_create(test_ctx, test_ctx->be_ctx, PERIOD, 0, 0, 0, 0,
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březina test_be_ptask_recv, NULL, "Test ptask", &ptask);
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březinavoid test_be_ptask_create_einval_recv(void **state)
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březina struct test_ctx *test_ctx = (struct test_ctx *)(*state);
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březina ret = be_ptask_create(test_ctx, test_ctx->be_ctx, PERIOD, 0, 0, 0, 0,
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březinavoid test_be_ptask_create_einval_name(void **state)
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březina struct test_ctx *test_ctx = (struct test_ctx *)(*state);
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březina ret = be_ptask_create(test_ctx, test_ctx->be_ctx, PERIOD, 0, 0, 0, 0,
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březinavoid test_be_ptask_create_no_delay(void **state)
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březina struct test_ctx *test_ctx = (struct test_ctx *)(*state);
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březina ret = be_ptask_create(test_ctx, test_ctx->be_ctx, PERIOD, 0, 0, 0, 0,
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březina test_be_ptask_recv, test_ctx, "Test ptask", &ptask);
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březina assert_true(ptask->last_execution <= test_ctx->when);
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březinavoid test_be_ptask_create_first_delay(void **state)
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březina struct test_ctx *test_ctx = (struct test_ctx *)(*state);
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březina ret = be_ptask_create(test_ctx, test_ctx->be_ctx, PERIOD, DELAY, 0, 0, 0,
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březina test_be_ptask_recv, test_ctx, "Test ptask", &ptask);
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březina assert_true(now + DELAY <= ptask->last_execution);
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březina assert_true(ptask->last_execution <= test_ctx->when);
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březina struct test_ctx *test_ctx = (struct test_ctx *)(*state);
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březina ret = be_ptask_create(test_ctx, test_ctx->be_ctx, PERIOD, 0, 0, 0, 0,
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březina test_be_ptask_recv, test_ctx, "Test ptask", &ptask);
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březina struct test_ctx *test_ctx = (struct test_ctx *)(*state);
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březina ret = be_ptask_create(test_ctx, test_ctx->be_ctx, PERIOD, 0, 0, 0, 0,
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březina test_be_ptask_recv, test_ctx, "Test ptask", &ptask);
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březina assert_true(ptask->last_execution <= test_ctx->when);
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březina struct test_ctx *test_ctx = (struct test_ctx *)(*state);
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březina ret = be_ptask_create(test_ctx, test_ctx->be_ctx, PERIOD, 0, DELAY, 0, 0,
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březina test_be_ptask_recv, test_ctx, "Test ptask", &ptask);
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březina assert_true(now + DELAY <= ptask->last_execution);
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březina assert_true(ptask->last_execution <= test_ctx->when);
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březina struct test_ctx *test_ctx = (struct test_ctx *)(*state);
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březina ret = be_ptask_create(test_ctx, test_ctx->be_ctx, PERIOD, 0, 0, 0, 0,
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březina test_be_ptask_recv, test_ctx, "Test ptask", &ptask);
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březina while (ptask->next_execution == next_execution && !test_ctx->done) {
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březina assert_true(next_execution + PERIOD <= ptask->next_execution);
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březinavoid test_be_ptask_offline_disable(void **state)
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březina struct test_ctx *test_ctx = (struct test_ctx *)(*state);
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březina ret = be_ptask_create(test_ctx, test_ctx->be_ctx, PERIOD, 0, 0, 0, 0,
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březina BE_PTASK_OFFLINE_DISABLE, 0, test_be_ptask_send,
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březina test_be_ptask_recv, test_ctx, "Test ptask", &ptask);
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březinavoid test_be_ptask_offline_execute(void **state)
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březina struct test_ctx *test_ctx = (struct test_ctx *)(*state);
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březina ret = be_ptask_create(test_ctx, test_ctx->be_ctx, PERIOD, 0, 0, 0, 0,
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březina BE_PTASK_OFFLINE_EXECUTE, 0, test_be_ptask_send,
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březina test_be_ptask_recv, test_ctx, "Test ptask", &ptask);
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březina struct test_ctx *test_ctx = (struct test_ctx *)(*state);
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březina ret = be_ptask_create(test_ctx, test_ctx->be_ctx, PERIOD, 0, 0, 0, 0,
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březina test_be_ptask_recv, test_ctx, "Test ptask", &ptask);
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březina assert_true(ptask->last_execution <= test_ctx->when);
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březina assert_true(next_execution + PERIOD <= ptask->next_execution);
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březinavoid test_be_ptask_reschedule_null(void **state)
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březina struct test_ctx *test_ctx = (struct test_ctx *)(*state);
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březina ret = be_ptask_create(test_ctx, test_ctx->be_ctx, PERIOD, 0, 0, 0, 0,
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březina BE_PTASK_OFFLINE_SKIP, 0, test_be_ptask_null_send,
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březina assert_true(now + PERIOD <= ptask->next_execution);
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březinavoid test_be_ptask_reschedule_error(void **state)
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březina struct test_ctx *test_ctx = (struct test_ctx *)(*state);
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březina ret = be_ptask_create(test_ctx, test_ctx->be_ctx, PERIOD, 0, 0, 0, 0,
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březina test_be_ptask_error_recv, test_ctx, "Test ptask",
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březina assert_true(now + PERIOD <= ptask->next_execution);
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březinavoid test_be_ptask_reschedule_timeout(void **state)
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březina struct test_ctx *test_ctx = (struct test_ctx *)(*state);
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březina ret = be_ptask_create(test_ctx, test_ctx->be_ctx, PERIOD, 0, 0, 0, 1,
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březina BE_PTASK_OFFLINE_SKIP, 0, test_be_ptask_timeout_send,
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březina test_be_ptask_error_recv, test_ctx, "Test ptask",
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březina /* first iterate until the task is executed */
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březina while (!test_ctx->done && ptask->req == NULL) {
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březina /* then iterate until the request is destroyed */
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březina while (!test_ctx->done && ptask->req != NULL) {
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březina assert_true(now + PERIOD <= ptask->next_execution);
babaca78cc196e7e0dcc3e972347951a081159f2Pavel Březinavoid test_be_ptask_reschedule_backoff(void **state)
babaca78cc196e7e0dcc3e972347951a081159f2Pavel Březina struct test_ctx *test_ctx = (struct test_ctx *)(*state);
babaca78cc196e7e0dcc3e972347951a081159f2Pavel Březina ret = be_ptask_create(test_ctx, test_ctx->be_ctx, PERIOD, 0, 0, 0, 0,
babaca78cc196e7e0dcc3e972347951a081159f2Pavel Březina BE_PTASK_OFFLINE_SKIP, PERIOD*2, test_be_ptask_send,
babaca78cc196e7e0dcc3e972347951a081159f2Pavel Březina test_be_ptask_recv, test_ctx, "Test ptask", &ptask);
babaca78cc196e7e0dcc3e972347951a081159f2Pavel Březina /* first run */
5d69dd4d62dab877dfc3c88e410816034981915fPavel Březina /* We need to acquire timestamp for the second test here, since this
5d69dd4d62dab877dfc3c88e410816034981915fPavel Březina * is the closest value to the timestamp when the next event is
5d69dd4d62dab877dfc3c88e410816034981915fPavel Březina * scheduled. */
5d69dd4d62dab877dfc3c88e410816034981915fPavel Březina assert_true(now_first <= ptask->last_execution);
babaca78cc196e7e0dcc3e972347951a081159f2Pavel Březina assert_true(ptask->last_execution <= test_ctx->when);
babaca78cc196e7e0dcc3e972347951a081159f2Pavel Březina assert_true(next_execution + PERIOD <= ptask->next_execution);
babaca78cc196e7e0dcc3e972347951a081159f2Pavel Březina /* second run */
5d69dd4d62dab877dfc3c88e410816034981915fPavel Březina assert_true(now_backoff + PERIOD <= ptask->last_execution);
5d69dd4d62dab877dfc3c88e410816034981915fPavel Březina assert_true(now_backoff + PERIOD <= test_ctx->when);
babaca78cc196e7e0dcc3e972347951a081159f2Pavel Březina assert_true(ptask->last_execution <= test_ctx->when);
babaca78cc196e7e0dcc3e972347951a081159f2Pavel Březina assert_true(next_execution + PERIOD*2 <= ptask->next_execution);
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březina struct test_ctx *test_ctx = (struct test_ctx *)(*state);
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březina ret = be_ptask_create(test_ctx, test_ctx->be_ctx, PERIOD, 0, 0, 0, 0,
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březina test_be_ptask_recv, test_ctx, "Test ptask", &ptask);
e89c2cb5ec77d57ed93952dae08df51738834fafSumit Bose struct test_ctx *test_ctx = (struct test_ctx *)(*state);
e89c2cb5ec77d57ed93952dae08df51738834fafSumit Bose ret = be_ptask_create(test_ctx, test_ctx->be_ctx, PERIOD, 0, 0, 0, TIMEOUT,
e89c2cb5ec77d57ed93952dae08df51738834fafSumit Bose test_be_ptask_recv, test_ctx, "Test ptask", &ptask);
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březina struct test_ctx *test_ctx = (struct test_ctx *)(*state);
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březina ret = be_ptask_create_sync(test_ctx, test_ctx->be_ctx, PERIOD, 0, 0, 0, 0,
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březina assert_true(ptask->last_execution <= test_ctx->when);
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březinavoid test_be_ptask_sync_reschedule_ok(void **state)
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březina struct test_ctx *test_ctx = (struct test_ctx *)(*state);
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březina ret = be_ptask_create_sync(test_ctx, test_ctx->be_ctx, PERIOD, 0, 0, 0, 0,
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březina while (!is_sync_ptask_finished(test_ctx, ptask)) {
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březina assert_true(ptask->last_execution <= test_ctx->when);
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březina assert_true(next_execution + PERIOD <= ptask->next_execution);
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březinavoid test_be_ptask_sync_reschedule_error(void **state)
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březina struct test_ctx *test_ctx = (struct test_ctx *)(*state);
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březina ret = be_ptask_create_sync(test_ctx, test_ctx->be_ctx, PERIOD, 0, 0, 0, 0,
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březina while (!is_sync_ptask_finished(test_ctx, ptask)) {
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březina assert_true(now + PERIOD <= ptask->next_execution);
babaca78cc196e7e0dcc3e972347951a081159f2Pavel Březinavoid test_be_ptask_sync_reschedule_backoff(void **state)
babaca78cc196e7e0dcc3e972347951a081159f2Pavel Březina struct test_ctx *test_ctx = (struct test_ctx *)(*state);
babaca78cc196e7e0dcc3e972347951a081159f2Pavel Březina ret = be_ptask_create_sync(test_ctx, test_ctx->be_ctx, PERIOD, 0, 0, 0, 0,
babaca78cc196e7e0dcc3e972347951a081159f2Pavel Březina /* first run */
babaca78cc196e7e0dcc3e972347951a081159f2Pavel Březina while (!is_sync_ptask_finished(test_ctx, ptask)) {
5d69dd4d62dab877dfc3c88e410816034981915fPavel Březina /* We need to acquire timestamp for the second test here, since this
5d69dd4d62dab877dfc3c88e410816034981915fPavel Březina * is the closest value to the timestamp when the next event is
5d69dd4d62dab877dfc3c88e410816034981915fPavel Březina * scheduled. */
5d69dd4d62dab877dfc3c88e410816034981915fPavel Březina assert_true(now_first <= ptask->last_execution);
babaca78cc196e7e0dcc3e972347951a081159f2Pavel Březina assert_true(ptask->last_execution <= test_ctx->when);
babaca78cc196e7e0dcc3e972347951a081159f2Pavel Březina assert_true(next_execution + PERIOD <= ptask->next_execution);
babaca78cc196e7e0dcc3e972347951a081159f2Pavel Březina /* second run */
babaca78cc196e7e0dcc3e972347951a081159f2Pavel Březina while (!is_sync_ptask_finished(test_ctx, ptask)) {
5d69dd4d62dab877dfc3c88e410816034981915fPavel Březina assert_true(now_backoff + PERIOD <= ptask->last_execution);
5d69dd4d62dab877dfc3c88e410816034981915fPavel Březina assert_true(now_backoff + PERIOD <= test_ctx->when);
babaca78cc196e7e0dcc3e972347951a081159f2Pavel Březina assert_true(ptask->last_execution <= test_ctx->when);
babaca78cc196e7e0dcc3e972347951a081159f2Pavel Březina assert_true(next_execution + PERIOD*2 <= ptask->next_execution);
57c5ea8825c7179fd93382dbcbb07e828e5aec19René Genz /* Set debug level to invalid value so we can decide if -d 0 was used. */
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březina pc = poptGetContext(argv[0], argc, argv, long_options, 0);
a5623363d6042290fe652a1ca5ce5a85a821236fPavel Březina fprintf(stderr, "\nInvalid option %s: %s\n\n",