This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
+ the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "includes.h"
"Event context loop failed");
for (i=0;i<ASYNC_COUNT;i++) {
if (done[i] == False && req[i]->state == RPC_REQUEST_DONE) {
+ int rounded_tdiff;
total_done++;
done[i] = True;
rcv[i] = timeval_current();
diff[i] = timeval_until(&snd[i], &rcv[i]);
+ rounded_tdiff = (int)(0.5 + diff[i].tv_sec + (1.0e-6*diff[i].tv_usec));
status = dcerpc_ndr_request_recv(req[i]);
+ printf("rounded_tdiff=%d\n", rounded_tdiff);
torture_assert_ntstatus_ok(tctx, status,
talloc_asprintf(tctx, "TestSleep(%d) failed", i));
torture_assert(tctx, r[i].out.result == r[i].in.seconds,
talloc_asprintf(tctx, "Failed - Asked to sleep for %u seconds (server replied with %u seconds and the reply takes only %u seconds)",
r[i].out.result, r[i].in.seconds, (uint_t)diff[i].tv_sec));
- torture_assert(tctx, r[i].out.result <= diff[i].tv_sec,
+ torture_assert(tctx, r[i].out.result <= rounded_tdiff,
talloc_asprintf(tctx, "Failed - Slept for %u seconds (but reply takes only %u.%06u seconds)",
r[i].out.result, (uint_t)diff[i].tv_sec, (uint_t)diff[i].tv_usec));
- if (r[i].out.result+1 == diff[i].tv_sec) {
+ if (r[i].out.result+1 == rounded_tdiff) {
torture_comment(tctx, "Slept for %u seconds (but reply takes %u.%06u seconds - busy server?)\n",
r[i].out.result, (uint_t)diff[i].tv_sec, (uint_t)diff[i].tv_usec);
- } else if (r[i].out.result == diff[i].tv_sec) {
+ } else if (r[i].out.result == rounded_tdiff) {
torture_comment(tctx, "Slept for %u seconds (reply takes %u.%06u seconds - ok)\n",
r[i].out.result, (uint_t)diff[i].tv_sec, (uint_t)diff[i].tv_usec);
} else {
r.in.seconds = 2;
p->request_timeout = 1;
- torture_assert(tctx, req = dcerpc_echo_TestSleep_send(p, tctx, &r),
- "Failed to send async sleep request");
+ req = dcerpc_echo_TestSleep_send(p, tctx, &r);
+ if (!req) {
+ torture_comment(tctx, "Failed to send async sleep request\n");
+ goto failed;
+ }
+ req->ignore_timeout = True;
status = dcerpc_ndr_request_recv(req);
torture_assert_ntstatus_equal(tctx, status, NT_STATUS_IO_TIMEOUT,
torture_comment(tctx, "Failed to send async sleep request\n");
goto failed;
}
+ req->ignore_timeout = True;
status = dcerpc_ndr_request_recv(req);
torture_assert_ntstatus_equal(tctx, status, NT_STATUS_IO_TIMEOUT,
"request should have timed out");
struct torture_suite *torture_rpc_echo(void)
{
struct torture_suite *suite = torture_suite_create(
- talloc_autofree_context(), "ECHO");
+ talloc_autofree_context(), "ECHO");
struct torture_tcase *tcase;
tcase = torture_suite_add_rpc_iface_tcase(suite, "echo",
- &dcerpc_table_rpcecho);
+ &ndr_table_rpcecho);
torture_rpc_tcase_add_test(tcase, "addone", test_addone);
torture_rpc_tcase_add_test(tcase, "sinkdata", test_sinkdata);