1#!/usr/bin/perl -w 2# 3# Copyright (c) International Business Machines Corp., 2000 4# 5# This program is free software; you can redistribute it and/or modify 6# it under the terms of the GNU General Public License as published by 7# the Free Software Foundation; either version 2 of the License, or 8# (at your option) any later version. 9# 10# This program is distributed in the hope that it will be useful, 11# but WITHOUT ANY WARRANTY; without even the implied warranty of 12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See 13# the 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, write to the Free Software 17# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 18# 19 20# 21# FILE(s) : backbeat 22# DESCRIPTION : Test takes 3 partitions (ex: /dev/hda1 /dev/hda2 /dev/hda3) and simulates 23# an online backup of /sbin using cp, tar and diff. 24# AUTHOR : Jeff Martin (martinjn@us.ibm.com) 25# HISTORY : 26# 27 28($junk,$junk,$part1)=split(/\//,$ARGV[0]); 29($junk,$junk,$part2)=split(/\//,$ARGV[1]); 30($junk,$junk,$part3)=split(/\//,$ARGV[2]); 31 32mkdir ("$part1/sbin"); 33print "\ncp:\n"; 34print `cp -aL /sbin/* $part1/sbin`; 35print "\ncd:\n"; 36chdir "$part1" || die "Can't cd to $part1: $!\n"; 37print "\ntar:\n"; 38print `tar -cf test.tar sbin`; 39print "\nmv:\n"; 40print `mv test.tar ../$part2`; 41 42chdir "../$part2" || die "Can't cd to ../$part2: $!\n"; 43 44`tar -xvf test.tar -C ../$part3`; 45 46chdir ".." || die "Can't cd to ..: $!\n"; 47 48$tmp = `diff -r $part3/sbin $part1/sbin`; 49 50if ($tmp) { 51 print $tmp; 52 print "\nDiff: FAIL\n"; 53 exit 1; 54 } 55 else { 56 print "\nDiff: PASS\n"; 57 exit 0; 58 } 59