blob: 7a7c85a5dfa4b0d186f6f065664286558a0ae833 [file] [log] [blame]
#!/bin/bash
# Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# Runs the update engine unit tests, including both userland and run-as-root
# tests.
if [ ! -e ./update_engine_unittests ]; then
echo 'Error: unit test binary missing' >&2
exit 1
fi
user_pass=0
./update_engine_unittests --gtest_filter='-*.RunAsRoot*' && user_pass=1
root_pass=0
sudo ./update_engine_unittests --gtest_filter='*.RunAsRoot*' && root_pass=1
echo -n "User tests: " && [ $user_pass == 1 ] && echo "PASSED" || echo "FAILED"
echo -n "Root tests: " && [ $root_pass == 1 ] && echo "PASSED" || echo "FAILED"
exit $((2 - user_pass - root_pass))