• Home
Name Date Size #Lines LOC

..--

android/03-May-2024-680366

common/03-May-2024-314163

cros_pkg/03-May-2024-849521

full_bisect_test/03-May-2024-864556

ndk/03-May-2024-417197

sysroot_wrapper/03-May-2024-492271

test/03-May-2024-963694

.gitignoreD03-May-202499 86

MAINTENANCED03-May-20245.7 KiB11693

README.bisectD03-May-20248.4 KiB214169

README.testingD03-May-20242.4 KiB8155

__init__.pyD03-May-20241 20

binary_search_perforce.pyD03-May-202414.1 KiB450365

binary_search_state.pyD03-May-202420.1 KiB599471

bisect.pyD03-May-202412.8 KiB399319

bisect_driver.pyD03-May-202410.1 KiB335234

common.pyD03-May-20247.5 KiB262207

compiler_wrapper.pyD03-May-20241.9 KiB6440

run_bisect_test.pyD03-May-20245 KiB173123

README.bisect

1
2bisect.py is a wrapper around the general purpose binary_search_state.py. It
3provides a user friendly interface for bisecting various compilation errors.
4The 2 currently provided methods of bisecting are ChromeOS package and object
5bisection. Each method defines a default set of options to pass to
6binary_search_state.py and allow the user to override these defaults (see
7the "Overriding" section).
8
9** NOTE **
10All commands, examples, scripts, etc. are to be run from your chroot unless
11stated otherwise.
12
13Bisection Methods:
14
151) ChromeOS Package:
16  This method will bisect across all packages in a ChromeOS repository and find
17  the offending packages (according to your test script). This method takes the
18  following arguments:
19
20    board: The board to bisect on. For example: daisy, falco, etc.
21    remote: The IP address of the physical machine you're using to test with.
22
23  By default the ChromeOS package method will do a simple interactive test that
24  pings the machine and prompts the user if the machine is good.
25
26  a) Setup:
27    The ChromeOS package method requires that you have three build trees:
28
29      /build/${board}.bad  - The build tree for your "bad" build
30      /build/${board}.good - The build tree for your "good" build
31      /build/${board}.work - A full copy of /build/${board}.bad
32
33  b) Cleanup:
34    bisect.py does most cleanup for you, the only thing required by the user is
35    to cleanup all built images and the three build trees made in /build/
36
37  c) Default Arguments:
38    --get_initial_items='cros_pkg/get_initial_items.sh'
39    --switch_to_good='cros_pkg/switch_to_good.sh'
40    --switch_to_bad='cros_pkg/switch_to_bad.sh'
41    --test_setup_script='cros_pkg/test_setup.sh'
42    --test_script='cros_pkg/interactive_test.sh'
43    --incremental
44    --prune
45    --file_args
46
47  d) Additional Documentation:
48    See ./cros_pkg/README.cros_pkg_triage for full documentation of ChromeOS
49    package bisection.
50
51  e) Examples:
52    i)  Basic interactive test package bisection, on daisy board:
53        ./bisect.py package daisy 172.17.211.184
54
55    ii) Basic boot test package bisection, on daisy board:
56        ./bisect.py package daisy 172.17.211.184 -t cros_pkg/boot_test.sh
57
582) ChromeOS Object:
59  This method will bisect across all objects in a ChromeOS package and find
60  the offending objects (according to your test script). This method takes the
61  following arguments:
62
63    board: The board to bisect on. For example: daisy, falco, etc.
64    remote: The IP address of the physical machine you're using to test with.
65    package: The package to bisect with. For example: chromeos-chrome
66    dir: (Optional) the directory for your good/bad build trees. Defaults to
67         $BISECT_DIR or /tmp/sysroot_bisect. This value will set $BISECT_DIR
68         for all bisecting scripts.
69
70  By default the ChromeOS object method will do a simple interactive test that
71  pings the machine and prompts the user if the machine is good.
72
73  a) Setup:
74    The ChromeOS package method requires that you populate your good and bad set
75    of objects. sysroot_wrapper will automatically detect the BISECT_STAGE
76    variable and use this to populate emerged objects. Here is an example:
77
78      # Defaults to /tmp/sysroot_bisect
79      export BISECT_DIR="/path/to/where/you/want/to/store/builds/"
80
81      export BISECT_STAGE="POPULATE_GOOD"
82      ./switch_to_good_compiler.sh
83      emerge-${board} -C ${package_to_bisect}
84      emerge-${board} ${package_to_bisect}
85
86      export BISECT_STAGE="POPULATE_BAD"
87      ./switch_to_bad_compiler.sh
88      emerge-${board} -C {package_to_bisect}
89      emerge-${board} ${package_to_bisect}
90
91  b) Cleanup:
92    The user must clean up all built images and the populated object files.
93
94  c) Default Arguments:
95    --get_initial_items='sysroot_wrapper/get_initial_items.sh'
96    --switch_to_good='sysroot_wrapper/switch_to_good.sh'
97    --switch_to_bad='sysroot_wrapper/switch_to_bad.sh'
98    --test_setup_script='sysroot_wrapper/test_setup.sh'
99    --test_script='sysroot_wrapper/interactive_test.sh'
100    --noincremental
101    --prune
102    --file_args
103
104  d) Additional Documentation:
105    See ./sysroot_wrapper/README for full documentation of ChromeOS object file
106    bisecting.
107
108  e) Examples:
109    i)  Basic interactive test object bisection, on daisy board for
110        cryptohome package:
111        ./bisect.py object daisy 172.17.211.184 cryptohome
112
113    ii) Basic boot test package bisection, on daisy board for cryptohome
114        package:
115        ./bisect.py object daisy 172.17.211.184 cryptohome \
116        --test_script=sysroot_wrapper/boot_test.sh
117
1183) Android object:
119  NOTE: Because this isn't a ChromeOS bisection tool, the concept of a
120        chroot doesn't exist. Just run this tool from a normal shell.
121
122  This method will bisect across all objects in the Android source tree and
123  find the offending objects (according to your test script). This method takes
124  the following arguments:
125
126    android_src: The location of your android source tree
127    num_jobs: (Optional) The number of jobs to pass to make. This is dependent
128              on how many cores your machine has. A good number is probably
129	      somewhere around 5 to 10.
130    device_id: (Optional) The serial code for the device you are testing on.
131               This is used to determine which device should be used in case
132	       multiple devices are plugged into your computer. You can get
133	       serial code for your device by running "adb devices".
134    dir: (Optional) the directory for your good/bad build trees. Defaults to
135         $BISECT_DIR or ~/ANDROID_BISECT/. This value will set $BISECT_DIR
136         for all bisecting scripts.
137
138  By default the Android object method will do a simple interactive test that
139  pings the machine and prompts the user if the machine is good.
140
141  a) Setup:
142    The Android object method requires that you populate your good and bad set
143    of objects. The Android compiler wrapper will automatically detect the
144    BISECT_STAGE variable and use this to populate emerged objects. Here is an
145    example:
146
147      # Defaults to ~/ANDROID_BISECT/
148      export BISECT_DIR="/path/to/where/you/want/to/store/builds/"
149
150      export BISECT_STAGE="POPULATE_GOOD"
151      # Install the "good" compiler
152      ./switch_to_good_compiler.sh
153      make clean
154      make -j <your_preferred_number_of_jobs>
155
156      export BISECT_STAGE="POPULATE_BAD"
157      # Install the "bad" compiler
158      ./switch_to_bad_compiler.sh
159      make clean
160      make -j <your_preferred_number_of_jobs>
161
162  b) Cleanup:
163    The user must clean up all built images and the populated object files.
164
165  c) Default Arguments:
166    --get_initial_items='android/get_initial_items.sh'
167    --switch_to_good='android/switch_to_good.sh'
168    --switch_to_bad='android/switch_to_bad.sh'
169    --test_setup_script='android/test_setup.sh'
170    --test_script='android/interactive_test.sh'
171    --incremental
172    --prune
173    --file_args
174
175  d) Additional Documentation:
176    See ./android/README.android for full documentation of Android object file
177    bisecting.
178
179  e) Examples:
180    i)  Basic interactive test android bisection, where the android source is
181        at ~/android_src:
182        ./bisect.py android ~/android_src
183
184    ii) Basic boot test android bisection, where the android source is at
185        ~/android_src, and 10 jobs will be used to build android:
186        ./bisect.py android ~/android_src --num_jobs=10 \
187        --test_script=sysroot_wrapper/boot_test.sh
188
189Resuming:
190  bisect.py and binary_search_state.py offer the ability to resume a bisection
191  in case it was interrupted by a SIGINT, power failure, etc. Every time the
192  tool completes a bisection iteration its state is saved to disk (usually to
193  the file "./bisect.py.state"). If passed the --resume option, the tool
194  it will automatically detect the state file and resume from the last
195  completed iteration.
196
197Overriding:
198  You can run ./bisect.py --help or ./binary_search_state.py --help for a full
199  list of arguments that can be overriden. Here are a couple of examples:
200
201  Example 1 (do boot test instead of interactive test):
202  ./bisect.py package daisy 172.17.211.182 --test_script=cros_pkg/boot_test.sh
203
204  Example 2 (do package bisector system test instead of interactive test, this
205             is used to test the bisecting tool itself -- see comments in
206             hash_test.sh for more details):
207  ./bisect.py package daisy 172.17.211.182 \
208    --test_script=common/hash_test.sh --test_setup_script=""
209
210  Example 3 (enable verbose mode, disable pruning, and disable verification):
211  ./bisect.py package daisy 172.17.211.182 \
212  --verbose --prune=False --verify=False
213
214

README.testing

1This file explains how to set up and run the various kinds of bisection tests.
2
3The bisection tool comes with several sets of tests which you should
4run after updating any of the bisection tool scripts OR after updating
5the Android compiler wrapper (to make sure the wrapper will still work
6correctly with bisection).
7
8Before you start.
9----------------
10
11Before you can run the tests, your PYTHONPATH environment variable
12must be correct.  This means that it must include both the
13toolchain-utils directory and the binary_search_tool directory.  The
14easiest way to set it is:
15
16$ cd toolchain-utils
17$ export PYTHONPATH=`pwd`:${PYTHONPATH}
18$ cd binary_search_tool
19$ export PYTHONPATH=`pwd`:${PYTHONPATH}
20
21
22Running the unittests.
23----------------------
24
25To run the basic unit tests:
26
27$ cd toolchain-utils/binary_search_tool/test
28$ ./binary_search_tool_tester.py
29
30Running the bisection tests, testing the compiler wrapper.
31----------------------------------------------------------
32
33If you want to run the bisection tests, and test the compiler wrapper
34(to make sure the POPULATE_GOOD and POPULATE_BAD stages are still
35working properly) you can do the following.
36
37If you are testing with the ANDROID COMPILER WRAPPER, you need to to some
38preliminary setup:
39
40Set up the compiler wrapper to replace GCC:
41
42    $ cd <android-root/prebuilts/clang/host/linux-x86/clang-368880/bin
43    $ cp clang gcc
44    $ whereis gcc
45    gcc: /usr/bin/gcc /usr/lib/gcc /usr/bin/X11/gcc /usr/share/man/man1/gcc.1.gz
46    $ cd /usr/bin
47    $ ls -l gcc
48    lrwxrwxrwx 1 root root 7 Feb  3 17:00 gcc -> gcc-4.8*
49    $ sudo mv gcc gcc.real
50    $ sudo ln -s <android-root>/prebuilts/clang/host/linux-x86/clang-3688880/bin/gcc gcc
51
52Move to the correct directory, then run the test script:
53
54    $ cd toolchain-utils/binary_search_tool
55    $ ./run_bisect_test.py
56
57
58If you are testing with the CHROMEOS COMPILER WRAPPER, you MUST run the
59tests from INSIDE your CHROOT (but you don't need to do any special setup):
60
61    $ cd <path-to-chromeos-root>
62    $ cros_sdk
63    $ cd ~/trunk/src/third_party/toolchain-utils
64
65    Set up your PYTHONPATH:
66
67    $ export PYTHONPATH=`pwd`:${PYTHONPATH}
68    $ cd binary_search_tool
69    $ export PYTHONPATH=`pwd`:${PYTHONPATH}
70
71    Run the test script:
72
73    $ ./run_bisect_test.py
74
75
76Running the bisection tests, without testing the compiler wrapper.
77------------------------------------------------------------------
78
79$ cd toolchain-utils/binary_search_tool
80$ ./full_bisect_test/run-test-nowrapper.sh
81