OLD | NEW |
---|---|
1 #!/bin/bash -eu | 1 #!/bin/bash -eu |
2 | 2 |
3 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 3 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
6 # | 6 # |
7 # Run tests for RSA Signature verification. | 7 # Run tests for RSA Signature verification. |
8 | 8 |
9 # Load common constants and variables. | 9 # Load common constants and variables. |
10 . "$(dirname "$0")/common.sh" | 10 . "$(dirname "$0")/common.sh" |
11 | 11 |
12 GPT=$1 | 12 GPT=$(readlink -f "$1") |
13 [ -x "$GPT" ] || error "Can't execute $GPT" | 13 [ -x "$GPT" ] || error "Can't execute $GPT" |
14 warning "testing $GPT" | 14 |
15 # Run tests in a dedicated directory for easy cleanup or debugging. | |
16 DIR="${TEST_DIR}/cgpt_test_dir" | |
17 [ -d "$DIR" ] || mkdir -p "$DIR" | |
18 warning "testing $GPT in $DIR" | |
19 cd "$DIR" | |
15 | 20 |
16 echo "Create an empty file to use as the device..." | 21 echo "Create an empty file to use as the device..." |
17 NUM_SECTORS=1000 | 22 NUM_SECTORS=1000 |
18 DEV=$(mktemp) | 23 DEV=fake_dev.bin |
19 BOOTFILE=$(mktemp) | |
20 dd if=/dev/zero of=${DEV} conv=notrunc bs=512 count=${NUM_SECTORS} 2>/dev/null | 24 dd if=/dev/zero of=${DEV} conv=notrunc bs=512 count=${NUM_SECTORS} 2>/dev/null |
21 trap "rm -f ${DEV}" EXIT | |
vb
2010/08/19 23:15:35
so who's be cleaning up this stuff now?
Randall Spangler
2010/08/19 23:30:40
(Are you leaving it around so you can run the test
Bill Richardson
2010/08/19 23:59:34
Nobody's cleaning it up. The new directory sits in
| |
22 | 25 |
23 | 26 |
24 echo "Create a bunch of partitions, using the real GUID types..." | 27 echo "Create a bunch of partitions, using the real GUID types..." |
25 DATA_START=100 | 28 DATA_START=100 |
26 DATA_SIZE=20 | 29 DATA_SIZE=20 |
27 DATA_LABEL="data stuff" | 30 DATA_LABEL="data stuff" |
28 DATA_GUID='ebd0a0a2-b9e5-4433-87c0-68b6b72699c7' | 31 DATA_GUID='ebd0a0a2-b9e5-4433-87c0-68b6b72699c7' |
29 DATA_NUM=1 | 32 DATA_NUM=1 |
30 | 33 |
31 KERN_START=200 | 34 KERN_START=200 |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
105 $GPT boot -i ${KERN_NUM} ${DEV} >/dev/null | 108 $GPT boot -i ${KERN_NUM} ${DEV} >/dev/null |
106 | 109 |
107 echo "Check the PMBR's idea of the boot partition..." | 110 echo "Check the PMBR's idea of the boot partition..." |
108 X=$($GPT boot ${DEV}) | 111 X=$($GPT boot ${DEV}) |
109 Y=$($GPT show -u -i $KERN_NUM $DEV) | 112 Y=$($GPT show -u -i $KERN_NUM $DEV) |
110 [ "$X" = "$Y" ] || error "fail at line $LINENO" | 113 [ "$X" = "$Y" ] || error "fail at line $LINENO" |
111 | 114 |
112 echo "Done." | 115 echo "Done." |
113 | 116 |
114 happy "All tests passed." | 117 happy "All tests passed." |
OLD | NEW |