Blame elf/tst-glibc-hwcaps-cache.c

Packit Bot e2c958
/* Wrapper to invoke tst-glibc-hwcaps in a container, to test ld.so.cache.
Packit Bot e2c958
   Copyright (C) 2020 Free Software Foundation, Inc.
Packit Bot e2c958
   This file is part of the GNU C Library.
Packit Bot e2c958
Packit Bot e2c958
   The GNU C Library is free software; you can redistribute it and/or
Packit Bot e2c958
   modify it under the terms of the GNU Lesser General Public
Packit Bot e2c958
   License as published by the Free Software Foundation; either
Packit Bot e2c958
   version 2.1 of the License, or (at your option) any later version.
Packit Bot e2c958
Packit Bot e2c958
   The GNU C Library is distributed in the hope that it will be useful,
Packit Bot e2c958
   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit Bot e2c958
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit Bot e2c958
   Lesser General Public License for more details.
Packit Bot e2c958
Packit Bot e2c958
   You should have received a copy of the GNU Lesser General Public
Packit Bot e2c958
   License along with the GNU C Library; if not, see
Packit Bot e2c958
   <https://www.gnu.org/licenses/>.  */
Packit Bot e2c958
Packit Bot e2c958
/* This program is just a wrapper that runs ldconfig followed by
Packit Bot e2c958
   tst-glibc-hwcaps.  The actual test is provided via an
Packit Bot e2c958
   implementation in a sysdeps subdirectory.  */
Packit Bot e2c958
Packit Bot e2c958
#include <stdio.h>
Packit Bot e2c958
#include <stdlib.h>
Packit Bot e2c958
#include <support/support.h>
Packit Bot e2c958
#include <unistd.h>
Packit Bot e2c958
Packit Bot e2c958
int
Packit Bot e2c958
main (int argc, char **argv)
Packit Bot e2c958
{
Packit Bot e2c958
  /* Run ldconfig to populate the cache.  */
Packit Bot e2c958
  {
Packit Bot e2c958
    char *command = xasprintf ("%s/ldconfig", support_install_rootsbindir);
Packit Bot e2c958
    if (system (command) != 0)
Packit Bot e2c958
      return 1;
Packit Bot e2c958
    free (command);
Packit Bot e2c958
  }
Packit Bot e2c958
Packit Bot e2c958
  /* Reuse tst-glibc-hwcaps.  Since this code is running in a
Packit Bot e2c958
     container, we can launch it directly.  */
Packit Bot e2c958
  char *path = xasprintf ("%s/elf/tst-glibc-hwcaps", support_objdir_root);
Packit Bot e2c958
  execv (path, argv);
Packit Bot e2c958
  printf ("error: execv of %s failed: %m\n", path);
Packit Bot e2c958
  return 1;
Packit Bot e2c958
}