Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(159)

Side by Side Diff: tests/run_cgpt_tests.sh

Issue 2719008: Nearly complete rewrite of cgpt tool. (Closed) Base URL: ssh://git@chromiumos-git//vboot_reference.git
Patch Set: Created 10 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tests/common.sh ('k') | utility/Makefile » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #!/bin/bash -eu
2
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
5 # found in the LICENSE file.
6 #
7 # Run tests for RSA Signature verification.
8
9 # Load common constants and variables.
10 . "$(dirname "$0")/common.sh"
11
12 GPT=${1:-../cgpt/cgpt}
13 [ -x "$GPT" ] || error "Can't execute $GPT"
14 warning "testing $GPT"
15
16 echo "Create an empty file to use as the device..."
17 NUM_SECTORS=1000
18 DEV=$(mktemp)
19 BOOTFILE=$(mktemp)
20 dd if=/dev/zero of=${DEV} conv=notrunc bs=512 count=${NUM_SECTORS} 2>/dev/null
21 trap "rm -f ${DEV}" EXIT
22
23
24 echo "Create a bunch of partitions, using the real GUID types..."
25 DATA_START=100
26 DATA_SIZE=20
27 DATA_LABEL="data stuff"
28 DATA_GUID='ebd0a0a2-b9e5-4433-87c0-68b6b72699c7'
29 DATA_NUM=1
30
31 KERN_START=200
32 KERN_SIZE=30
33 KERN_LABEL="kernel stuff"
34 KERN_GUID='fe3a2a5d-4f32-41a7-b725-accc3285a309'
35 KERN_NUM=2
36
37 ROOTFS_START=300
38 ROOTFS_SIZE=40
39 ROOTFS_LABEL="rootfs stuff"
40 ROOTFS_GUID='3cb8e202-3b7e-47dd-8a3c-7ff2a13cfcec'
41 ROOTFS_NUM=3
42
43 ESP_START=400
44 ESP_SIZE=50
45 ESP_LABEL="ESP stuff"
46 ESP_GUID='c12a7328-f81f-11d2-ba4b-00a0c93ec93b'
47 ESP_NUM=4
48
49 FUTURE_START=500
50 FUTURE_SIZE=60
51 FUTURE_LABEL="future stuff"
52 FUTURE_GUID='2e0a753d-9e48-43b0-8337-b15192cb1b5e'
53 FUTURE_NUM=5
54
55 RANDOM_START=600
56 RANDOM_SIZE=70
57 RANDOM_LABEL="random stuff"
58 RANDOM_GUID='2364a860-bf63-42fb-a83d-9ad3e057fcf5'
59 RANDOM_NUM=6
60
61 $GPT create ${DEV}
62
63 $GPT add -b ${DATA_START} -s ${DATA_SIZE} -t ${DATA_GUID} \
64 -l "${DATA_LABEL}" ${DEV}
65 $GPT add -b ${KERN_START} -s ${KERN_SIZE} -t ${KERN_GUID} \
66 -l "${KERN_LABEL}" ${DEV}
67 $GPT add -b ${ROOTFS_START} -s ${ROOTFS_SIZE} -t ${ROOTFS_GUID} \
68 -l "${ROOTFS_LABEL}" ${DEV}
69 $GPT add -b ${ESP_START} -s ${ESP_SIZE} -t ${ESP_GUID} \
70 -l "${ESP_LABEL}" ${DEV}
71 $GPT add -b ${FUTURE_START} -s ${FUTURE_SIZE} -t ${FUTURE_GUID} \
72 -l "${FUTURE_LABEL}" ${DEV}
73 $GPT add -b ${RANDOM_START} -s ${RANDOM_SIZE} -t ${RANDOM_GUID} \
74 -l "${RANDOM_LABEL}" ${DEV}
75
76
77 echo "Extract the start and size of given partitions..."
78
79 X=$($GPT show -b -i $DATA_NUM ${DEV})
80 Y=$($GPT show -s -i $DATA_NUM ${DEV})
81 [ "$X $Y" = "$DATA_START $DATA_SIZE" ] || error "fail at line $LINENO"
82
83 X=$($GPT show -b -i $KERN_NUM ${DEV})
84 Y=$($GPT show -s -i $KERN_NUM ${DEV})
85 [ "$X $Y" = "$KERN_START $KERN_SIZE" ] || error "fail at line $LINENO"
86
87 X=$($GPT show -b -i $ROOTFS_NUM ${DEV})
88 Y=$($GPT show -s -i $ROOTFS_NUM ${DEV})
89 [ "$X $Y" = "$ROOTFS_START $ROOTFS_SIZE" ] || error "fail at line $LINENO"
90
91 X=$($GPT show -b -i $ESP_NUM ${DEV})
92 Y=$($GPT show -s -i $ESP_NUM ${DEV})
93 [ "$X $Y" = "$ESP_START $ESP_SIZE" ] || error "fail at line $LINENO"
94
95 X=$($GPT show -b -i $FUTURE_NUM ${DEV})
96 Y=$($GPT show -s -i $FUTURE_NUM ${DEV})
97 [ "$X $Y" = "$FUTURE_START $FUTURE_SIZE" ] || error "fail at line $LINENO"
98
99 X=$($GPT show -b -i $RANDOM_NUM ${DEV})
100 Y=$($GPT show -s -i $RANDOM_NUM ${DEV})
101 [ "$X $Y" = "$RANDOM_START $RANDOM_SIZE" ] || error "fail at line $LINENO"
102
103
104 echo "Set the boot partition.."
105 $GPT boot -i ${KERN_NUM} ${DEV} >/dev/null
106
107 echo "Check the PMBR's idea of the boot partition..."
108 X=$($GPT boot ${DEV})
109 Y=$($GPT show -u -i $KERN_NUM $DEV)
110 [ "$X" = "$Y" ] || error "fail at line $LINENO"
111
112 echo "Done."
113
114 happy "All tests passed."
OLDNEW
« no previous file with comments | « tests/common.sh ('k') | utility/Makefile » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698