Blame support/test-driver.h

Packit 6c4009
/* Interfaces for the test driver.
Packit 6c4009
   Copyright (C) 2016-2018 Free Software Foundation, Inc.
Packit 6c4009
   This file is part of the GNU C Library.
Packit 6c4009
Packit 6c4009
   The GNU C Library is free software; you can redistribute it and/or
Packit 6c4009
   modify it under the terms of the GNU Lesser General Public
Packit 6c4009
   License as published by the Free Software Foundation; either
Packit 6c4009
   version 2.1 of the License, or (at your option) any later version.
Packit 6c4009
Packit 6c4009
   The GNU C Library is distributed in the hope that it will be useful,
Packit 6c4009
   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 6c4009
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit 6c4009
   Lesser General Public License for more details.
Packit 6c4009
Packit 6c4009
   You should have received a copy of the GNU Lesser General Public
Packit 6c4009
   License along with the GNU C Library; if not, see
Packit 6c4009
   <http://www.gnu.org/licenses/>.  */
Packit 6c4009
Packit 6c4009
#ifndef SUPPORT_TEST_DRIVER_H
Packit 6c4009
#define SUPPORT_TEST_DRIVER_H
Packit 6c4009
Packit 6c4009
#include <sys/cdefs.h>
Packit 6c4009
Packit 6c4009
__BEGIN_DECLS
Packit 6c4009
Packit 6c4009
struct test_config
Packit 6c4009
{
Packit 6c4009
  void (*prepare_function) (int argc, char **argv);
Packit 6c4009
  int (*test_function) (void);
Packit 6c4009
  int (*test_function_argv) (int argc, char **argv);
Packit 6c4009
  void (*cleanup_function) (void);
Packit 6c4009
  void (*cmdline_function) (int);
Packit 6c4009
  const void *options;   /* Custom options if not NULL.  */
Packit 6c4009
  int timeout;           /* Test timeout in seconds.  */
Packit 6c4009
  int expected_status;   /* Expected exit status.  */
Packit 6c4009
  int expected_signal;   /* If non-zero, expect termination by signal.  */
Packit 6c4009
  char no_mallopt;       /* Boolean flag to disable mallopt.  */
Packit 6c4009
  char no_setvbuf;       /* Boolean flag to disable setvbuf.  */
Packit 6c4009
  const char *optstring; /* Short command line options.  */
Packit 6c4009
};
Packit 6c4009
Packit 6c4009
enum
Packit 6c4009
  {
Packit 6c4009
    /* Test exit status which indicates that the feature is
Packit 6c4009
       unsupported. */
Packit 6c4009
    EXIT_UNSUPPORTED = 77,
Packit 6c4009
Packit 6c4009
    /* Default timeout is twenty seconds.  Tests should normally
Packit 6c4009
       complete faster than this, but if they don't, that's abnormal
Packit 6c4009
       (a bug) anyways.  */
Packit 6c4009
    DEFAULT_TIMEOUT = 20,
Packit 6c4009
Packit 6c4009
    /* Used for command line argument parsing.  */
Packit 6c4009
    OPT_DIRECT = 1000,
Packit 6c4009
    OPT_TESTDIR,
Packit 6c4009
  };
Packit 6c4009
Packit 6c4009
/* Options provided by the test driver.  */
Packit 6c4009
#define TEST_DEFAULT_OPTIONS                            \
Packit 6c4009
  { "verbose", no_argument, NULL, 'v' },                \
Packit 6c4009
  { "direct", no_argument, NULL, OPT_DIRECT },          \
Packit 6c4009
  { "test-dir", required_argument, NULL, OPT_TESTDIR }, \
Packit 6c4009
Packit 6c4009
/* The directory the test should use for temporary files.  */
Packit 6c4009
extern const char *test_dir;
Packit 6c4009
Packit 6c4009
/* The number of --verbose arguments specified during program
Packit 6c4009
   invocation.  This variable can be used to control the verbosity of
Packit 6c4009
   tests.  */
Packit 6c4009
extern unsigned int test_verbose;
Packit 6c4009
Packit 6c4009
int support_test_main (int argc, char **argv, const struct test_config *);
Packit 6c4009
Packit 6c4009
__END_DECLS
Packit 6c4009
Packit 6c4009
#endif /* SUPPORT_TEST_DRIVER_H */