| OLD | NEW |
| 1 #!/bin/sh -u | 1 #!/bin/sh -u |
| 2 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 2 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 # | 5 # |
| 6 # Test the chromeos TPM recovery script by faking the entire execution | 6 # Test the chromeos TPM recovery script by faking the entire execution |
| 7 # environment. | 7 # environment. |
| 8 | 8 |
| 9 rm -rf tpm_recovery_test_workdir | 9 rm -rf tpm-recovery-test-workdir |
| 10 mkdir tpm_recovery_test_workdir | 10 mkdir tpm-recovery-test-workdir |
| 11 cd tpm_recovery_test_workdir | 11 cd tpm-recovery-test-workdir |
| 12 | 12 |
| 13 test_kind= | 13 test_kind= |
| 14 if [ $# -ge 1 ]; then | 14 if [ $# -ge 1 ]; then |
| 15 test_kind="$1" | 15 test_kind="$1" |
| 16 fi | 16 fi |
| 17 | 17 |
| 18 if [ "$test_kind" != "" -a "$test_kind" != "fake" ]; then | 18 if [ "$test_kind" != "" -a "$test_kind" != "fake" ]; then |
| 19 echo "$0: usage: $0 [fake]" | 19 echo "$0: usage: $0 [fake]" |
| 20 echo "With fake as the argument, use a simulated TPM instead of the real one" | 20 echo "With fake as the argument, use a simulated TPM instead of the real one" |
| 21 fi | 21 fi |
| 22 | 22 |
| 23 if [ "$test_kind" = "fake" ]; then | 23 if [ "$test_kind" = "fake" ]; then |
| 24 export USR_BIN=. | 24 export USR_BIN=. |
| 25 export USR_SBIN=. | 25 export USR_SBIN=. |
| 26 export USR_LOCAL_BIN=. | 26 export USR_LOCAL_BIN=. |
| 27 export USR_LOCAL_SBIN=. | 27 export USR_LOCAL_SBIN=. |
| 28 export DOT_RECOVERY=.recovery | 28 export DOT_RECOVERY=.recovery |
| 29 export ACPI_DIR=. | 29 export ACPI_DIR=. |
| 30 ctr=../chromeos_tpm_recovery | 30 ctr=../chromeos-tpm-recovery |
| 31 tpmc=./tpmc | 31 tpmc=./tpmc |
| 32 else | 32 else |
| 33 ctr=/usr/sbin/chromeos_tpm_recovery | 33 ctr=/usr/sbin/chromeos-tpm-recovery |
| 34 tpmc=tpmc | 34 tpmc=tpmc |
| 35 fi | 35 fi |
| 36 | 36 |
| 37 # For simplicity, build the permanent environment as if we prepared to run the | 37 # For simplicity, build the permanent environment as if we prepared to run the |
| 38 # fake test, even if we're running the test on a real TPM. | 38 # fake test, even if we're running the test on a real TPM. |
| 39 | 39 |
| 40 echo > .recovery | 40 echo > .recovery |
| 41 echo 3 > BINF.0 | 41 echo 3 > BINF.0 |
| 42 echo 0 > CHSW | 42 echo 0 > CHSW |
| 43 | 43 |
| (...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 334 $ctr log | 334 $ctr log |
| 335 } | 335 } |
| 336 | 336 |
| 337 test_normal_run | 337 test_normal_run |
| 338 test_wrong_id | 338 test_wrong_id |
| 339 test_wrong_size | 339 test_wrong_size |
| 340 test_wrong_size_hog | 340 test_wrong_size_hog |
| 341 | 341 |
| 342 echo "test completed" >> log | 342 echo "test completed" >> log |
| 343 echo "test completed" | 343 echo "test completed" |
| OLD | NEW |