Gilad Arnold | ab3bb45 | 2012-05-22 09:08:12 -0700 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
| 3 | # Copyright (c) 2012 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 | # Runs the update engine unit tests, including both userland and run-as-root |
| 8 | # tests. |
| 9 | |
| 10 | if [ ! -e ./update_engine_unittests ]; then |
| 11 | echo 'Error: unit test binary missing' >&2 |
| 12 | exit 1 |
| 13 | fi |
| 14 | |
Gilad Arnold | 5117871 | 2012-07-03 15:52:37 -0700 | [diff] [blame] | 15 | user_pass=0 |
| 16 | ./update_engine_unittests --gtest_filter='-*.RunAsRoot*' && user_pass=1 |
| 17 | root_pass=0 |
| 18 | sudo ./update_engine_unittests --gtest_filter='*.RunAsRoot*' && root_pass=1 |
| 19 | |
| 20 | echo -n "User tests: " && [ $user_pass == 1 ] && echo "PASSED" || echo "FAILED" |
| 21 | echo -n "Root tests: " && [ $root_pass == 1 ] && echo "PASSED" || echo "FAILED" |
Gilad Arnold | 9f8b93d | 2012-08-21 11:05:00 -0700 | [diff] [blame] | 22 | |
| 23 | exit $((2 - user_pass - root_pass)) |