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

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