From nobody Mon Feb 9 20:37:01 2026 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1711195535966330.4810127567258; Sat, 23 Mar 2024 05:05:35 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id CF7541EB0; Sat, 23 Mar 2024 08:05:34 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 408C91D5B; Sat, 23 Mar 2024 07:39:22 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id D9F441973; Sat, 23 Mar 2024 07:39:15 -0400 (EDT) Received: from mx1.osci.io (polly.osci.io [8.43.85.229]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 0ED021D58 for ; Sat, 23 Mar 2024 07:32:55 -0400 (EDT) Received: by mx1.osci.io (Postfix, from userid 994) id 739CA223FE; Fri, 22 Mar 2024 13:56:55 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (3072 bits) server-digest SHA256) (No client certificate requested) by mx1.osci.io (Postfix) with ESMTPS id D0FBB223FB for ; Fri, 22 Mar 2024 13:56:54 -0400 (EDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-213-eGsWO0z1OmSDcNnFu_yMAg-1; Fri, 22 Mar 2024 13:56:52 -0400 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 810DF84B165 for ; Fri, 22 Mar 2024 17:56:52 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.6]) by smtp.corp.redhat.com (Postfix) with ESMTP id EF24F492BD0 for ; Fri, 22 Mar 2024 17:56:51 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.7 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 X-MC-Unique: eGsWO0z1OmSDcNnFu_yMAg-1 From: Peter Krempa To: devel@lists.libvirt.org Subject: [PATCH 35/35] tests: Drop 'test-lib.sh' Date: Fri, 22 Mar 2024 18:56:13 +0100 Message-ID: <6c2d1e6847b500c3997d491d69b17bedc4e1f9f3.1711129973.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.10 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Message-ID-Hash: YYY5SAOFAMVUX2TVXXTZPLCJ3PPGODVS X-Message-ID-Hash: YYY5SAOFAMVUX2TVXXTZPLCJ3PPGODVS X-MailFrom: SRS0=Xa5W=K4=redhat.com=pkrempa@osci.io X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1711195537086100001 We no longer have any shell-based tests that use it. Signed-off-by: Peter Krempa --- tests/test-lib.sh | 280 ---------------------------------------------- 1 file changed, 280 deletions(-) delete mode 100644 tests/test-lib.sh diff --git a/tests/test-lib.sh b/tests/test-lib.sh deleted file mode 100644 index 67065a9362..0000000000 --- a/tests/test-lib.sh +++ /dev/null @@ -1,280 +0,0 @@ -# test-lib.sh: source this file; set up for tests - -# Copyright (C) 2008-2013, 2016 Red Hat, Inc. -# -# This 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. -# -# This 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 this library. If not, see -# . -# -# Based on an idea from GNU coreutils - -_scriptdir=3D"$(unset CDPATH; cd $(dirname $0) && pwd)" -test -z "$abs_srcdir" && abs_srcdir=3D$_scriptdir -test -z "$abs_builddir" && abs_builddir=3D$_scriptdir -test -z "$abs_top_srcdir" && abs_top_srcdir=3D$_scriptdir/.. -test -z "$abs_top_builddir" && abs_top_builddir=3D$_scriptdir/.. -test -z "$LC_ALL" && LC_ALL=3DC - -# Skip this test if the shell lacks support for functions. -unset function_test -eval 'function_test() { return 11; }; function_test' -if test $? !=3D 11; then - echo "$0: /bin/sh lacks support for functions; skipping this test." 1>&2 - (exit 77); exit 77 -fi - -test_intro() -{ - name=3D$1 - if test "$verbose" =3D "0" ; then - echo "TEST: $name" - printf " " - fi -} - -test_skip_case() -{ - counter=3D$1 - name=3D$2 - reason=3D$3 - if test "$verbose" =3D "0" ; then - mod=3D`expr \( $counter + 40 - 1 \) % 40` - if test "$counter" !=3D 1 && test "$mod" =3D 0 ; then - printf " %-3d\n" `expr $counter - 1` - printf " " - fi - printf "_" - else - printf "%3d) %-60s ... SKIP\n" "$counter" "$name" - printf " case skipped: %s\n" "$reason" - fi -} - -test_result() -{ - counter=3D$1 - name=3D$2 - status=3D$3 - if test "$verbose" =3D "0" ; then - mod=3D`expr \( $counter + 40 - 1 \) % 40` - if test "$counter" !=3D 1 && test "$mod" =3D 0 ; then - printf " %-3d\n" `expr $counter - 1` - printf " " - fi - if test "$status" =3D "0" ; then - printf "." - else - printf "!" - fi - else - if test "$status" =3D "0" ; then - printf "%3d) %-60s ... OK\n" "$counter" "$name" - else - printf "%3d) %-60s ... FAILED\n" "$counter" "$name" - fi - fi -} - -test_final() -{ - counter=3D$1 - status=3D$2 - - if test "$verbose" =3D "0" ; then - len=3D`expr 39 - \( \( $counter - 1 \) % 40 \)` - printf "%${len}s" "" - if test "$status" =3D "0" ; then - printf " %-3d OK\n" $counter - else - printf " %-3d FAILED\n" $counter - fi - fi -} - -skip_test_() -{ - echo "$0: skipping test: $@" 1>&2 - (exit 77); exit 77 -} - -require_acl_() -{ - getfacl --version < /dev/null > /dev/null 2>&1 \ - && setfacl --version < /dev/null > /dev/null 2>&1 \ - || skip_test_ "This test requires getfacl and setfacl." - - id -u bin > /dev/null 2>&1 \ - || skip_test_ "This test requires a local user named bin." -} - -require_ulimit_() -{ - ulimit_works=3Dyes - # Expect to be able to exec a program in 10MB of virtual memory, - # but not in 20KB. I chose "date". It must not be a shell built-in - # function, so you can't use echo, printf, true, etc. - # Of course, in coreutils, I could use $top_builddir/src/true, - # but this should be able to work for other projects, too. - ( ulimit -v 10000; date ) > /dev/null 2>&1 || ulimit_works=3Dno - ( ulimit -v 20; date ) > /dev/null 2>&1 && ulimit_works=3Dno - - test $ulimit_works =3D no \ - && skip_test_ "this shell lacks ulimit support" -} - -require_readable_root_() -{ - test -r / || skip_test_ "/ is not readable" -} - -# Skip the current test if strace is not available or doesn't work. -require_strace_() -{ - strace -V < /dev/null > /dev/null 2>&1 || - skip_test_ 'no strace program' - - strace -qe unlink echo > /dev/null 2>&1 || - skip_test_ 'strace does not work' -} - -require_built_() -{ - skip_=3Dno - for i in "$@"; do - case " $built_programs " in - *" $i "*) ;; - *) echo "$i: not built" 1>&2; skip_=3Dyes ;; - esac - done - - test $skip_ =3D yes && skip_test_ "required program(s) not built" -} - -uid_is_privileged_() -{ - # Make sure id -u succeeds. - my_uid=3D$(id -u) \ - || { echo "$0: cannot run \`id -u'" 1>&2; return 1; } - - # Make sure it gives valid output. - case $my_uid in - 0) ;; - *[!0-9]*) - echo "$0: invalid output (\`$my_uid') from \`id -u'" 1>&2 - return 1 ;; - *) return 1 ;; - esac -} - -skip_if_() -{ - case $1 in - root) skip_test_ must be run as root ;; - non-root) skip_test_ must be run as non-root ;; - *) ;; # FIXME? - esac -} - -require_selinux_() -{ - case `ls -Zd .` in - '? .'|'unlabeled .') - skip_test_ "this system (or maybe just" \ - "the current file system) lacks SELinux support" - ;; - esac -} - -test_expensive() -{ - if test "$VIR_TEST_EXPENSIVE" !=3D 1; then - skip_test_ ' -This test is very expensive, so it is disabled by default. -To change the default, configure with: meson -Dexpensive_tests=3Denabled -' - fi -} - -require_root_() { uid_is_privileged_ || skip_test_ "must be run as root"; } -skip_if_root_() { uid_is_privileged_ && skip_test_ "must be run as non-roo= t"; } -error_() { echo "$0: $@" 1>&2; (exit 1); exit 1; } -framework_failure() { error_ 'failure in testing framework'; } - -mkfifo_or_skip_() -{ - test $# =3D 1 || framework_failure - if ! mkfifo "$1"; then - # Make an exception of this case -- usually we interpret framework-cre= ation - # failure as a test failure. However, in this case, when running on a= SunOS - # system using a disk NFS mounted from OpenBSD, the above fails like t= his: - # mkfifo: cannot make fifo `fifo-10558': Not owner - skip_test_ 'NOTICE: unable to create test prerequisites' - fi -} - -# Create mock XDG files/directories to avoid permission problems. -# As it points inside $test_dir_, it is automatically cleaned. -mock_xdg_() -{ - export XDG_CONFIG_HOME=3D"$t_/.config" - export XDG_CACHE_HOME=3D"$t_/.cache" - export XDG_RUNTIME_HOME=3D"$XDG_CACHE_HOME" - - mkdir -p "$XDG_CONFIG_HOME/libvirt" "$XDG_CONFIG_HOME/virsh" - mkdir -p "$XDG_CACHE_HOME/libvirt" "$XDG_CACHE_HOME/virsh" - mkdir -p "$XDG_RUNTIME_HOME/libvirt" "$XDG_RUNTIME_HOME/virsh" -} - -test_dir_=3D$(pwd) - -this_test_() { echo "./$0" | sed 's,.*/,,'; } -this_test=3D$(this_test_) - -verbose=3D0 -if test -n "$VIR_TEST_DEBUG" || test -n "$VIR_TEST_VERBOSE" ; then - verbose=3D1 -fi - -debug() { :; } - -if test "$VIR_TEST_DEBUG" =3D "2"; then - debug() { echo "$@"; } -fi - -# This is a stub function that is run upon trap (upon regular exit and -# interrupt). Override it with a per-test function, e.g., to unmount -# a partition, or to undo any other global state changes. -cleanup_() { :; } - -t_=3D$("mktemp" "-d" "$test_dir_/lv-$this_test.XXXXXXXXXX") \ - || error_ "failed to create temporary directory in $test_dir_" - -# Run each test from within a temporary sub-directory named after the -# test itself, and arrange to remove it upon exception or normal exit. -trap 'st=3D$?; cleanup_; d=3D'"$t_"'; - cd '"$test_dir_"' && chmod -R u+rwx "$d" && rm -rf "$d" && exit $st' 0 -trap '(exit $?); exit $?' 1 2 13 15 - -cd "$t_" || error_ "failed to cd to $t_" - -if ( diff --version < /dev/null 2>&1 | grep GNU ) > /dev/null 2>&1; then - compare() { diff -u "$@"; } -elif ( cmp --version < /dev/null 2>&1 | grep GNU ) > /dev/null 2>&1; then - compare() { cmp -s "$@"; } -else - compare() { cmp "$@"; } -fi - -# Local Variables: -# indent-tabs-mode: nil -# End: --=20 2.44.0 _______________________________________________ Devel mailing list -- devel@lists.libvirt.org To unsubscribe send an email to devel-leave@lists.libvirt.org