Home | History | Annotate | Download | only in test_scripts
      1 #!/bin/bash
      2 
      3 # Test the copying of a large directory hierarchy...while deleting it.
      4 
      5 # Copyright (C) 2003-2006 IBM
      6 #
      7 # This program is free software; you can redistribute it and/or
      8 # modify it under the terms of the GNU General Public License as
      9 # published by the Free Software Foundation; either version 2 of the
     10 # License, or (at your option) any later version.
     11 #
     12 # This program is distributed in the hope that it will be useful, but
     13 # WITHOUT ANY WARRANTY; without even the implied warranty of
     14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     15 # General Public License for more details.
     16 #
     17 # You should have received a copy of the GNU General Public License
     18 # along with this program; if not, write to the Free Software
     19 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
     20 # 02111-1307, USA.
     21 
     22 TREE_DEST="$POUNDER_TMPDIR/copytree/"
     23 
     24 # Set up the erase
     25 trap 'echo Cleaning up...; rm -rf "$TREE_DEST"; echo Clean.; exit 0'  1 2 15
     26 
     27 # Copy the data
     28 mkdir -p "$TREE_DEST"
     29 cp -pRdu /usr "$TREE_DEST"
     30 
     31 # Compare the data
     32 diff -Naur /usr "$TREE_DEST/usr/" | tee "$POUNDER_TMPDIR/copytree.diff"
     33 
     34 # Clean up
     35 rm -rf "$TREE_DEST"
     36 
     37 # Anything in the diff?
     38 DIFF_ERRORS=`wc -l < $POUNDER_TMPDIR/copytree.diff`
     39 if [ $DIFF_ERRORS -gt 0 ]; then
     40         exit $DIFF_ERRORS
     41 fi
     42 
     43 exit 0
     44