From: lace <> Date: Sun, 25 Dec 2005 09:12:49 +0000 (+0000) Subject: Compatibility testing script made public. X-Git-Tag: bp_HEAD~8 X-Git-Url: https://git.jankratochvil.net/?p=captive.git;a=commitdiff_plain;h=f00e8ba78c2f01c5f44494c3709d1301fafd72c3 Compatibility testing script made public. --- diff --git a/src/install/acquire/Makefile.am b/src/install/acquire/Makefile.am index 83c0620..c48f502 100644 --- a/src/install/acquire/Makefile.am +++ b/src/install/acquire/Makefile.am @@ -70,7 +70,8 @@ EXTRA_DIST+= \ $(GLADE_IN) \ cabextract/.vimrc \ captivemodid-list.pl \ - captivemodid-print.pl + captivemodid-print.pl \ + compatibility-test.sh captive_install_acquire-ui-gnome-interface.$(OBJEXT): ui-gnome-callbacks.h diff --git a/src/install/acquire/compatibility-test.sh b/src/install/acquire/compatibility-test.sh new file mode 100755 index 0000000..e8f8dce --- /dev/null +++ b/src/install/acquire/compatibility-test.sh @@ -0,0 +1,124 @@ +#! /bin/sh +# +# $Id$ +# Test compatibility of the "ntfs.sys" and "ntoskrnl.exe" files. +# Copyright (C) 2005 Jan Kratochvil +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; exactly version 2 of June 1991 is required +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + +# Example result: +# + + +set -e +#set -x + +# Directory containing /ntfs.sys/* and /ntoskrnl.exe/* files to test. +out="$1" + +# Second directory containing files exactly like $out; appended. +out_extra="$2" + +# Binary regular file containing NTFS image with >=1500k of free space. +# This file is never modified. +image="$3" + + +test -d "$out" +test -d "$out_extra" +test -f "$image" + +# Test commit() at the written 1MB: +head -qc 1500k /dev/urandom >/tmp/captive-sanity-orig.bin +rm -rf /tmp/captive-sanity-module +mkdir /tmp/captive-sanity-module + +: >/tmp/captive-sanity-out-all + +count_ntfs=` echo $out/ntfs.sys/* $out_extra/ntfs.sys/* |tr ' ' '\n'|wc -l` +count_ntoskrnl=`echo $out/ntoskrnl.exe/* $out_extra/ntoskrnl.exe/*|tr ' ' '\n'|wc -l` +count_combo=$[$count_ntfs*$count_ntoskrnl] + +total_passed=0 +total_export=0 +total_error=0 +total_ok=0 + +cat </tmp/captive-sanity-command +put /tmp/captive-sanity-orig.bin sanity.bin +get sanity.bin /tmp/captive-sanity-copy.bin +quit +HERE + +for ntfs_sys in $out/ntfs.sys/* $out_extra/ntfs.sys/* ;do +rm -f /tmp/captive-sanity-module/ntfs.sys +ln $ntfs_sys /tmp/captive-sanity-module/ntfs.sys + +for ntoskrnl_exe in $out/ntoskrnl.exe/* $out_extra/ntoskrnl.exe/*;do +rm -f /tmp/captive-sanity-module/ntoskrnl.exe +ln $ntoskrnl_exe /tmp/captive-sanity-module/ntoskrnl.exe + +rm -f /tmp/captive-sanity-copy.bin +set +e +../../client/cmdline/captive-cmdline /tmp/captive-sanity-out +error=$? +set -e +if grep -q 'Export not found for: ' /tmp/captive-sanity-out;then + total_export=$[$total_export+1] +elif [ $error -ne 0 ];then + total_error=$[$total_error+1] + cat /tmp/captive-sanity-out + cat <>/tmp/captive-sanity-out-all +-------- +ntfs.sys=$ntfs_sys +ntoskrnl.exe=$ntoskrnl_exe +HERE + cat /tmp/captive-sanity-out >>/tmp/captive-sanity-out-all +else + cmp /tmp/captive-sanity-orig.bin /tmp/captive-sanity-copy.bin + total_ok=$[$total_ok+1] +fi +rm -f /tmp/captive-sanity-copy.bin + +total_passed=$[$total_passed+1] +echo "done: $total_passed of $count_combo [total_export=$total_export total_error=$total_error total_ok=$total_ok]" + +done +done 2>&1 | grep -v 'sanity: line .*: .* Aborted.*captive-cmdline' + +rm -rf /tmp/captive-sanity-module +rm -f /tmp/captive-sanity-orig.bin +rm -f /tmp/captive-sanity-command + +echo "--------" +cat /tmp/captive-sanity-out-all + +echo "--------" +echo /tmp/captive-sanity-out-all + +# Do not: echo "total_export=$total_export" +# echo "total_error=$total_error" +# echo "total_ok=$total_ok" +# as the variables will not pass out of the 'for...done' loop above.