From: Stefan Berger Subject: [PATCH][RESEND][vTPM][XM-TEST] echo command string break-up fix Date: Tue, 12 Sep 2006 16:08:36 -0400 Message-ID: <1158091716.21656.0.camel@941e-2.watson.ibm.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-L5N5Yr6ADVbn0F/UOCvG" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel Cc: Ewan Mellor List-Id: xen-devel@lists.xenproject.org --=-L5N5Yr6ADVbn0F/UOCvG Content-Type: text/plain Content-Transfer-Encoding: 7bit When redirecting the output of the echo command using '>' on bash, the output seems to be broken up into multiple write()s (depending on the version of busybox?). Unfortunately /dev/tpm0 needs to have the complete command written to in one chunk. The work-around 'echo > file ; cat file > /dev/tpm0' seems to get around this problem. The patch also removes a redundant test and error output. Signed-off-by: Stefan Berger --=-L5N5Yr6ADVbn0F/UOCvG Content-Disposition: attachment; filename=vtpm-test-echo-problem-fix.diff Content-Type: text/x-patch; name=vtpm-test-echo-problem-fix.diff; charset=UTF-8 Content-Transfer-Encoding: 7bit Index: root/xen-unstable.hg/tools/xm-test/tests/vtpm/06_vtpm-susp_res_pcrs.py =================================================================== --- root.orig/xen-unstable.hg/tools/xm-test/tests/vtpm/06_vtpm-susp_res_pcrs.py +++ root/xen-unstable.hg/tools/xm-test/tests/vtpm/06_vtpm-susp_res_pcrs.py @@ -42,7 +42,7 @@ except ConsoleError, e: FAIL("Error while creating /dev/tpm0") try: - run = console.runCmd("echo -ne \"\\x00\\xc1\\x00\\x00\\x00\\x22\\x00\\x00\\x00\\x14\\x00\\x00\\x00\\x00\\x01\\x02\\x03\\x04\\x05\\x06\\x07\\x08\\x09\\x0a\\x0b\\x0c\\x0d\\x0e\\0xf\\x10\\x11\\x12\\x13\\x14\" > /dev/tpm0") + run = console.runCmd("echo -ne \"\\x00\\xc1\\x00\\x00\\x00\\x22\\x00\\x00\\x00\\x14\\x00\\x00\\x00\\x00\\x01\\x02\\x03\\x04\\x05\\x06\\x07\\x08\\x09\\x0a\\x0b\\x0c\\x0d\\x0e\\0xf\\x10\\x11\\x12\\x13\\x14\" > seq; cat seq > /dev/tpm0") except ConsoleError, e: saveLog(console.getHistory()) vtpm_cleanup(domName) Index: root/xen-unstable.hg/tools/xm-test/tests/vtpm/07_vtpm-mig_pcrs.py =================================================================== --- root.orig/xen-unstable.hg/tools/xm-test/tests/vtpm/07_vtpm-mig_pcrs.py +++ root/xen-unstable.hg/tools/xm-test/tests/vtpm/07_vtpm-mig_pcrs.py @@ -43,7 +43,7 @@ except ConsoleError, e: FAIL("Error while creating /dev/tpm0") try: - run = console.runCmd("echo -ne \"\\x00\\xc1\\x00\\x00\\x00\\x22\\x00\\x00\\x00\\x14\\x00\\x00\\x00\\x00\\x01\\x02\\x03\\x04\\x05\\x06\\x07\\x08\\x09\\x0a\\x0b\\x0c\\x0d\\x0e\\0xf\\x10\\x11\\x12\\x13\\x14\" > /dev/tpm0") + run = console.runCmd("echo -ne \"\\x00\\xc1\\x00\\x00\\x00\\x22\\x00\\x00\\x00\\x14\\x00\\x00\\x00\\x00\\x01\\x02\\x03\\x04\\x05\\x06\\x07\\x08\\x09\\x0a\\x0b\\x0c\\x0d\\x0e\\0xf\\x10\\x11\\x12\\x13\\x14\" > seq; cat seq > /dev/tpm0") except ConsoleError, e: saveLog(console.getHistory()) vtpm_cleanup(domName) Index: root/xen-unstable.hg/tools/xm-test/tests/vtpm/08_vtpm-mig_pcrs.py =================================================================== --- root.orig/xen-unstable.hg/tools/xm-test/tests/vtpm/08_vtpm-mig_pcrs.py +++ root/xen-unstable.hg/tools/xm-test/tests/vtpm/08_vtpm-mig_pcrs.py @@ -43,7 +43,7 @@ except ConsoleError, e: FAIL("Error while creating /dev/tpm0") try: - run = console.runCmd("echo -ne \"\\x00\\xc1\\x00\\x00\\x00\\x22\\x00\\x00\\x00\\x14\\x00\\x00\\x00\\x00\\x01\\x02\\x03\\x04\\x05\\x06\\x07\\x08\\x09\\x0a\\x0b\\x0c\\x0d\\x0e\\0xf\\x10\\x11\\x12\\x13\\x14\" > /dev/tpm0") + run = console.runCmd("echo -ne \"\\x00\\xc1\\x00\\x00\\x00\\x22\\x00\\x00\\x00\\x14\\x00\\x00\\x00\\x00\\x01\\x02\\x03\\x04\\x05\\x06\\x07\\x08\\x09\\x0a\\x0b\\x0c\\x0d\\x0e\\0xf\\x10\\x11\\x12\\x13\\x14\" > seq; cat seq > /dev/tpm0") except ConsoleError, e: saveLog(console.getHistory()) vtpm_cleanup(domName) Index: root/xen-unstable.hg/tools/xm-test/tests/vtpm/vtpm_utils.py =================================================================== --- root.orig/xen-unstable.hg/tools/xm-test/tests/vtpm/vtpm_utils.py +++ root/xen-unstable.hg/tools/xm-test/tests/vtpm/vtpm_utils.py @@ -8,9 +8,6 @@ from XmTestLib import * if ENABLE_HVM_SUPPORT: SKIP("vtpm tests not supported for HVM domains") -if not os.path.exists("/dev/tpm0"): - SKIP("This machine has no hardware TPM; cannot run this test") - status, output = traceCommand("ps aux | grep vtpm_manager | grep -v grep") if output == "": FAIL("virtual TPM manager must be started to run this test") --=-L5N5Yr6ADVbn0F/UOCvG Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --=-L5N5Yr6ADVbn0F/UOCvG--