|
Packit Service |
cd82a4 |
/* Main program with DT_AUDIT. One audit module.
|
|
Packit Service |
cd82a4 |
Copyright (C) 2020 Free Software Foundation, Inc.
|
|
Packit Service |
cd82a4 |
This file is part of the GNU C Library.
|
|
Packit Service |
cd82a4 |
|
|
Packit Service |
cd82a4 |
The GNU C Library is free software; you can redistribute it and/or
|
|
Packit Service |
cd82a4 |
modify it under the terms of the GNU Lesser General Public
|
|
Packit Service |
cd82a4 |
License as published by the Free Software Foundation; either
|
|
Packit Service |
cd82a4 |
version 2.1 of the License, or (at your option) any later version.
|
|
Packit Service |
cd82a4 |
|
|
Packit Service |
cd82a4 |
The GNU C Library is distributed in the hope that it will be useful,
|
|
Packit Service |
cd82a4 |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit Service |
cd82a4 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit Service |
cd82a4 |
Lesser General Public License for more details.
|
|
Packit Service |
cd82a4 |
|
|
Packit Service |
cd82a4 |
You should have received a copy of the GNU Lesser General Public
|
|
Packit Service |
cd82a4 |
License along with the GNU C Library; if not, see
|
|
Packit Service |
cd82a4 |
<https://www.gnu.org/licenses/>. */
|
|
Packit Service |
cd82a4 |
|
|
Packit Service |
cd82a4 |
#include <stdlib.h>
|
|
Packit Service |
cd82a4 |
#include <string.h>
|
|
Packit Service |
cd82a4 |
#include <support/check.h>
|
|
Packit Service |
cd82a4 |
#include <support/xstdio.h>
|
|
Packit Service |
cd82a4 |
|
|
Packit Service |
cd82a4 |
static int
|
|
Packit Service |
cd82a4 |
do_test (void)
|
|
Packit Service |
cd82a4 |
{
|
|
Packit Service |
cd82a4 |
/* Verify what the audit module has written. This test assumes that
|
|
Packit Service |
cd82a4 |
standard output has been redirected to a regular file. */
|
|
Packit Service |
cd82a4 |
FILE *fp = xfopen ("/dev/stdout", "r");
|
|
Packit Service |
cd82a4 |
|
|
Packit Service |
cd82a4 |
char *buffer = NULL;
|
|
Packit Service |
cd82a4 |
size_t buffer_length = 0;
|
|
Packit Service |
cd82a4 |
size_t line_length = xgetline (&buffer, &buffer_length, fp);
|
|
Packit Service |
cd82a4 |
const char *message = "info: tst-auditlogmod-1.so loaded\n";
|
|
Packit Service |
cd82a4 |
TEST_COMPARE_BLOB (message, strlen (message), buffer, line_length);
|
|
Packit Service |
cd82a4 |
|
|
Packit Service |
cd82a4 |
/* No more audit module output. */
|
|
Packit Service |
cd82a4 |
line_length = xgetline (&buffer, &buffer_length, fp);
|
|
Packit Service |
cd82a4 |
TEST_COMPARE_BLOB ("", 0, buffer, line_length);
|
|
Packit Service |
cd82a4 |
|
|
Packit Service |
cd82a4 |
free (buffer);
|
|
Packit Service |
cd82a4 |
xfclose (fp);
|
|
Packit Service |
cd82a4 |
return 0;
|
|
Packit Service |
cd82a4 |
}
|
|
Packit Service |
cd82a4 |
|
|
Packit Service |
cd82a4 |
#include <support/test-driver.c>
|