Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / chrome / test / chromeos / autotest / files / client / deps / chrome_test / setup_test_links.sh
1 #!/bin/bash
2 #
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.
6 #
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.
10
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" \
15     "$this_dir/locales"
16 [ -L "$this_dir/resources" ] || ln -f -s "/opt/google/chrome/resources" \
17     "$this_dir/resources"
18 ln -f -s /opt/google/chrome/*.pak "$this_dir/"
19
20 # NaCl symlinks.
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/"
24
25 # Create links to resources from pyauto_dep.
26
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
31     exit 1
32 fi
33
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
37 # if necessary.
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
44     done
45 }
46
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"/*
58
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"
62