Home | History | Annotate | Download | only in nfs_stress
      1 #! /bin/sh
      2 # Copyright (c) 2015 Oracle and/or its affiliates. All Rights Reserved.
      3 # Copyright (c) International Business Machines  Corp., 2001
      4 #
      5 # This program is free software; you can redistribute it and/or
      6 # modify it under the terms of the GNU General Public License as
      7 # published by the Free Software Foundation; either version 2 of
      8 # the License, or (at your option) any later version.
      9 #
     10 # This program is distributed in the hope that it would be useful,
     11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
     12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     13 # GNU General Public License for more details.
     14 #
     15 # You should have received a copy of the GNU General Public License
     16 # along with this program. If not, see <http://www.gnu.org/licenses/>.
     17 #
     18 # PURPOSE: Tests NFS copy of various filesizes, file consistency
     19 #          between copies and preservation of write/nowrite permissions.
     20 #
     21 # Ported by: Robbie Williamson (robbiew (at] us.ibm.com)
     22 
     23 TCID="nfs02"
     24 TST_TOTAL=3
     25 TST_CLEANUP="nfs_cleanup"
     26 
     27 . nfs_lib.sh
     28 . test_net.sh
     29 
     30 do_test1()
     31 {
     32 	tst_resm TINFO "do_test1 $TC"
     33 	ROD cp $LTP_DATAFILES/ascii.jmb .
     34 	tst_resm TINFO "compare both ascii.jmbs"
     35 	ROD diff $LTP_DATAFILES/ascii.jmb ascii.jmb
     36 
     37 	tst_resm TPASS "test1 passed"
     38 }
     39 
     40 do_test2()
     41 {
     42 	tst_resm TINFO "do_test2, copy data files"
     43 	local files="ascii.sm ascii.med ascii.lg"
     44 
     45 	for f in $files; do
     46 		tst_resm TINFO "copy '$f' file"
     47 		ROD cp $LTP_DATAFILES/$f .
     48 		ROD cp $f ${f}cp
     49 		ROD diff $LTP_DATAFILES/$f ${f}cp
     50 	done
     51 
     52 	tst_resm TPASS "test2 passed"
     53 }
     54 
     55 do_test3()
     56 {
     57 	tst_resm TINFO "do_test3, test permissions"
     58 	ROD chmod a-wx ascii.sm
     59 	ROD ls -l ascii.sm | grep -q "r--"
     60 	ROD chmod a+w ascii.sm
     61 	tst_resm TPASS "test3 passed"
     62 }
     63 
     64 LTP_DATAFILES="$LTPROOT/testcases/bin/datafiles"
     65 
     66 nfs_setup
     67 
     68 do_test1
     69 do_test2
     70 do_test3
     71 
     72 tst_exit
     73