• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/sh
2# SPDX-License-Identifier: GPL-2.0-or-later
3# Copyright (c) 2020 SUSE LLC <mdoucha@suse.cz>
4#
5# Generate LTP runfile for LVM tests (runtest/lvm.local)
6
7TST_TESTFUNC=generate_runfile
8TST_NEEDS_ROOT=1
9TST_NEEDS_CMDS="sed"
10. tst_test.sh
11
12LVM_DIR="${LVM_DIR:-/tmp}"
13LVM_TMPDIR="$LVM_DIR/ltp/growfiles"
14
15generate_runfile()
16{
17	trap 'tst_brk TBROK "Cannot create LVM runfile"' ERR
18	INFILE="$LTPROOT/testcases/data/lvm/runfile.tpl"
19	OUTFILE="$LTPROOT/runtest/lvm.local"
20	FS_LIST=`tst_supported_fs`
21	echo -n "" >"$OUTFILE"
22
23	for fsname in $FS_LIST; do
24		# Btrfs needs too much space for reliable stress testing
25		if [ "x$fsname" != "xbtrfs" ]; then
26			sed -e "s/{fsname}/$fsname/g; s^{tempdir}^$LVM_TMPDIR^g" "$INFILE" >>"$OUTFILE"
27		fi
28	done
29
30	tst_res TPASS "Runfile $OUTFILE successfully created"
31}
32
33tst_run
34