Blame SOURCES/0050-tests-Add-t4201-to-test-partprobe-with-1025-devices.patch

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