3 # Copyright (c) 2012 The Chromium 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.
7 # A script to setup symbolic links needed for Chrome's automated UI tests.
8 # Should be run on test image after installing the 'chrome_test' and
9 # 'pyauto_dep' dependencies.
11 # TODO(rkc): Figure out why does the sym linking break tests, eventually
12 this_dir="$(readlink -f $(dirname $0))"
13 [ -f "$this_dir/chrome" ] || cp "/opt/google/chrome/chrome" "$this_dir/chrome"
14 [ -L "$this_dir/locales" ] || ln -f -s "/opt/google/chrome/locales" \
16 [ -L "$this_dir/resources" ] || ln -f -s "/opt/google/chrome/resources" \
18 ln -f -s /opt/google/chrome/*.pak "$this_dir/"
21 ln -f -s /opt/google/chrome/nacl_helper "$this_dir/"
22 ln -f -s /opt/google/chrome/nacl_helper_bootstrap "$this_dir/"
23 ln -f -s /opt/google/chrome/nacl_irt_*.nexe "$this_dir/"
25 # Create links to resources from pyauto_dep.
27 chrome_test_dep_dir=$(readlink -f "$this_dir/../../..")
28 pyauto_dep_dir=$(readlink -f "$chrome_test_dep_dir/../pyauto_dep")
29 if [ ! -d "$pyauto_dep_dir" ]; then
30 echo "'pyauto_dep' dependency is missing. Install it first." >&2
34 # Create symlink(s) to the given abs path(s) in 'pyauto_dep' dependency
35 # pointing from the corresponding item in 'chrome_test' dependency
36 # (if the destination doesn't already exist). Intermediate dirs are created
38 function link_from_pyauto_dep() {
39 for src_path in $@; do
40 [[ "$src_path" == "/usr/local/autotest/deps/pyauto_dep"/* ]] || return
41 dest_path="${src_path/pyauto_dep/chrome_test}"
42 mkdir -p "$(dirname "$dest_path")"
43 [ -e "$dest_path" ] || ln -f -s $src_path $dest_path
47 link_from_pyauto_dep \
48 "$pyauto_dep_dir/test_src/chrome/browser/resources/gaia_auth" \
49 "$pyauto_dep_dir/test_src/chrome/test/pyautolib" \
50 "$pyauto_dep_dir/test_src/net/tools/testserver" \
51 "$pyauto_dep_dir/test_src/out/Release/chromedriver" \
52 "$pyauto_dep_dir/test_src/out/Release/pyautolib.py" \
53 "$pyauto_dep_dir/test_src/out/Release/pyproto" \
54 "$pyauto_dep_dir/test_src/out/Release/suid-python" \
55 "$pyauto_dep_dir/test_src/out/Release/_pyautolib.so" \
56 "$pyauto_dep_dir/test_src/out/Release/libffmpegsumo.so" \
57 "$pyauto_dep_dir/test_src/third_party"/*
59 # Make sure the test files are owned by chronos as some browser_tests emit
60 # temporary files into the directories.
61 chown -R chronos "$chrome_test_dep_dir"