LCOV - code coverage report
Current view: top level - lib/torture - simple.c (source / functions) Hit Total Coverage
Test: coverage report for master 2b515b7d Lines: 0 31 0.0 %
Date: 2024-02-28 12:06:22 Functions: 0 6 0.0 %

          Line data    Source code
       1             : /*
       2             :    Unix SMB/CIFS implementation.
       3             :    SMB torture tester
       4             :    Copyright (C) Andrew Tridgell 1997-2003
       5             :    Copyright (C) Jelmer Vernooij 2006-2008
       6             : 
       7             :    This program is free software; you can redistribute it and/or modify
       8             :    it under the terms of the GNU General Public License as published by
       9             :    the Free Software Foundation; either version 3 of the License, or
      10             :    (at your option) any later version.
      11             : 
      12             :    This program is distributed in the hope that it will be useful,
      13             :    but WITHOUT ANY WARRANTY; without even the implied warranty of
      14             :    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      15             :    GNU General Public License for more details.
      16             : 
      17             :    You should have received a copy of the GNU General Public License
      18             :    along with this program.  If not, see <http://www.gnu.org/licenses/>.
      19             : */
      20             : 
      21             : #include "includes.h"
      22             : #include "lib/torture/torture.h"
      23             : 
      24             : static struct timeval last_suite_started;
      25             : 
      26           0 : static void simple_suite_start(struct torture_context *ctx,
      27             :                                struct torture_suite *suite)
      28             : {
      29           0 :         last_suite_started = timeval_current();
      30           0 :         printf("Running %s\n", suite->name);
      31           0 : }
      32             : 
      33           0 : static void simple_suite_finish(struct torture_context *ctx,
      34             :                                 struct torture_suite *suite)
      35             : {
      36             : 
      37           0 :         printf("%s took %g secs\n\n", suite->name,
      38             :                    timeval_elapsed(&last_suite_started));
      39           0 : }
      40             : 
      41           0 : static void simple_test_result(struct torture_context *context,
      42             :                                enum torture_result res, const char *reason)
      43             : {
      44           0 :         switch (res) {
      45           0 :         case TORTURE_OK:
      46           0 :                 if (reason)
      47           0 :                         printf("OK: %s\n", reason);
      48           0 :                 break;
      49           0 :         case TORTURE_FAIL:
      50           0 :                 printf("TEST %s FAILED! - %s\n", context->active_test->name, reason);
      51           0 :                 break;
      52           0 :         case TORTURE_ERROR:
      53           0 :                 printf("ERROR IN TEST %s! - %s\n", context->active_test->name, reason);
      54           0 :                 break;
      55           0 :         case TORTURE_SKIP:
      56           0 :                 printf("SKIP: %s - %s\n", context->active_test->name, reason);
      57           0 :                 break;
      58             :         }
      59           0 : }
      60             : 
      61           0 : static void simple_comment(struct torture_context *test,
      62             :                            const char *comment)
      63             : {
      64           0 :         printf("%s", comment);
      65           0 : }
      66             : 
      67           0 : static void simple_warning(struct torture_context *test,
      68             :                            const char *comment)
      69             : {
      70           0 :         fprintf(stderr, "WARNING: %s\n", comment);
      71           0 : }
      72             : 
      73           0 : static void simple_progress(struct torture_context *test,
      74             :         int offset, enum torture_progress_whence whence)
      75             : {
      76           0 : }
      77             : 
      78             : const struct torture_ui_ops torture_simple_ui_ops  = {
      79             :         .comment = simple_comment,
      80             :         .warning = simple_warning,
      81             :         .suite_start = simple_suite_start,
      82             :         .suite_finish = simple_suite_finish,
      83             :         .test_result = simple_test_result,
      84             :         .progress = simple_progress,
      85             : };

Generated by: LCOV version 1.14