From bbe5e56e7c8718f416610b48afadada543e1d58e Mon Sep 17 00:00:00 2001 From: "Brian C. Lane" Date: Mon, 25 Feb 2019 16:20:14 -0800 Subject: [PATCH 50/50] tests: Add t4201 to test partprobe with 1025 devices This makes sure partprobe is closing the device and doesn't run out of file descriptors. Uses scsi_debug to create 1025 devices (descriptor limit is 1024). Also adds partprobe to the TESTS_ENVIRONMENT PATH, otherwise it will use the partprobe installed on the system when running the tests. Related: rhbz#1551411 --- tests/Makefile.am | 3 ++- tests/t4201-partprobe-1025-disks.sh | 37 +++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 1 deletion(-) create mode 100755 tests/t4201-partprobe-1025-disks.sh diff --git a/tests/Makefile.am b/tests/Makefile.am index 29fa280..f11be8a 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -52,6 +52,7 @@ TESTS = \ t4100-msdos-partition-limits.sh \ t4100-msdos-starting-sector.sh \ t4200-partprobe.sh \ + t4201-partprobe-1025-disks.sh \ t4300-nilfs2-tiny.sh \ t5000-tags.sh \ t6000-dm.sh \ @@ -120,7 +121,7 @@ TESTS_ENVIRONMENT = \ PERL='$(PERL)' \ PREFERABLY_POSIX_SHELL='$(PREFERABLY_POSIX_SHELL)' \ REPLACE_GETCWD=$(REPLACE_GETCWD) \ - PATH='$(abs_top_builddir)/parted$(PATH_SEPARATOR)'"$$PATH" \ + PATH='$(abs_top_builddir)/parted$(PATH_SEPARATOR)$(abs_top_builddir)/partprobe$(PATH_SEPARATOR)'"$$PATH" \ VERSION=$(VERSION) \ ; 9>&2 diff --git a/tests/t4201-partprobe-1025-disks.sh b/tests/t4201-partprobe-1025-disks.sh new file mode 100755 index 0000000..f6cdec5 --- /dev/null +++ b/tests/t4201-partprobe-1025-disks.sh @@ -0,0 +1,37 @@ +#!/bin/sh +# Make sure partprobe is closing the devices + +# Copyright (C) 2008-2012 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. + +# This program 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 General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +. "${srcdir=.}/init.sh"; path_prepend_ ../parted +require_root_ +require_scsi_debug_module_ +ss=$sector_size_ + +scsi_debug_acquire_lock_ + +# load scsi_debug directly, using scsi_debug_setup_ fails with all the unexpected devices +modprobe scsi_debug dev_size_mb=1 num_tgts=1025 > dev-name || + skip_ 'failed to create scsi_debug device' + +# So that scsi_debug_cleanup_ will run +scsi_debug_modprobe_succeeded_=1 + +# ensure that partprobe succeeds and produces no output" +partprobe > out 2>err || fail=1 +compare /dev/null err || fail=1 + +Exit $fail -- 2.20.1