Update kernel version to 5.13 in tst-mman-consts.py
[glibc.git] / elf / tst-audit14.c
blobc57c2184c341ac5c0b40efabeb0a3cfc36221478
1 /* Main program with DT_AUDIT. One audit module.
2 Copyright (C) 2020-2021 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
19 #include <stdlib.h>
20 #include <string.h>
21 #include <support/check.h>
22 #include <support/xstdio.h>
24 static int
25 do_test (void)
27 /* Verify what the audit module has written. This test assumes that
28 standard output has been redirected to a regular file. */
29 FILE *fp = xfopen ("/dev/stdout", "r");
31 char *buffer = NULL;
32 size_t buffer_length = 0;
33 size_t line_length = xgetline (&buffer, &buffer_length, fp);
34 const char *message = "info: tst-auditlogmod-1.so loaded\n";
35 TEST_COMPARE_BLOB (message, strlen (message), buffer, line_length);
37 /* No more audit module output. */
38 line_length = xgetline (&buffer, &buffer_length, fp);
39 TEST_COMPARE_BLOB ("", 0, buffer, line_length);
41 free (buffer);
42 xfclose (fp);
43 return 0;
46 #include <support/test-driver.c>