xref: /aosp_15_r20/external/ltp/testcases/network/nfs/nfs_stress/nfs02.sh (revision 49cdfc7efb34551c7342be41a7384b9c40d7cab7)
1#! /bin/sh
2# SPDX-License-Identifier: GPL-2.0-or-later
3# Copyright (c) 2015-2018 Oracle and/or its affiliates. All Rights Reserved.
4# Copyright (c) International Business Machines  Corp., 2001
5#
6# PURPOSE: Tests NFS copy of various filesizes, file consistency
7#          between copies and preservation of write/nowrite permissions.
8#
9# Ported by: Robbie Williamson ([email protected])
10
11TST_CNT=3
12TST_TESTFUNC="do_test"
13LTP_DATAFILES="$LTPROOT/testcases/bin/datafiles"
14
15do_test1()
16{
17	tst_res TINFO "do_test1 $TC"
18	ROD cp $LTP_DATAFILES/ascii.jmb .
19	tst_res TINFO "compare both ascii.jmbs"
20	ROD diff $LTP_DATAFILES/ascii.jmb ascii.jmb
21
22	tst_res TPASS "test1 passed"
23}
24
25do_test2()
26{
27	tst_res TINFO "do_test2, copy data files"
28	local files="ascii.sm ascii.med ascii.lg"
29
30	for f in $files; do
31		tst_res TINFO "copy '$f' file"
32		ROD cp $LTP_DATAFILES/$f .
33		ROD cp $f ${f}cp
34		ROD diff $LTP_DATAFILES/$f ${f}cp
35	done
36
37	tst_res TPASS "test2 passed"
38}
39
40do_test3()
41{
42	tst_res TINFO "do_test3, test permissions"
43	ROD chmod a-wx ascii.sm
44	ROD ls -l ascii.sm | grep -q "r--"
45	ROD chmod a+w ascii.sm
46	tst_res TPASS "test3 passed"
47}
48
49. nfs_lib.sh
50tst_run
51