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