Edit

thodg/libiconv/tests/is-native.c

Branch :

  • Show log

    Commit

  • Author : Bruno Haible
    Date : 2021-09-19 23:13:57
    Hash : 05b20c93
    Message : tests: Avoid check-subst failures in QEMU user-mode environments. * Makefile.devel (GNULIB_MODULES): Add stdbool. (gnulib-imported-files): Copy also tests/qemu.h. * tests/is-native.c: New file. * tests/Makefile.in (is-native, is-native.@OBJEXT@): New targets. (clean): Remove the 'is-native' program. (SOURCE_FILES): Add is-native.c. (IMPORTED_FILES): Add qemu.h. * tests/check-subst: Invoke 'locale charmap' only in native environments.

  • tests/is-native.c
  • /* Copyright (C) 2021 Free Software Foundation, Inc.
       This file is part of the GNU LIBICONV Library.
    
       The GNU LIBICONV Library is free software; you can redistribute it
       and/or modify it under the terms of the GNU Lesser General Public
       License as published by the Free Software Foundation; either version 2.1
       of the License, or (at your option) any later version.
    
       The GNU LIBICONV Library is distributed in the hope that it will be
       useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
       Lesser General Public License for more details.
    
       You should have received a copy of the GNU Lesser General Public
       License along with the GNU LIBICONV Library; see the file COPYING.LIB.
       If not, see <https://www.gnu.org/licenses/>.  */
    
    #include "config.h"
    
    #include "qemu.h"
    
    /* Returns 0 (success) in a native environment.
       Returns 1 (failure) in a cross-executing environment, that is, in an
       environment where compiled programs use a different libc than the system's
       libc.  Currently, only QEMU user-mode environments are recognized.  */
    
    int main ()
    {
      return is_running_under_qemu_user () ? 1 : 0;
    }