From 30f4e9d47a67aee5dae0953e53408cf1b2a15ac0 Mon Sep 17 00:00:00 2001 From: Marko Budiselic Date: Tue, 21 Feb 2017 15:44:12 +0100 Subject: [PATCH] Futex test execution time was too long Summary: Futex test execution time was too long Test Plan: manual Reviewers: dgleich Reviewed By: dgleich Subscribers: pullbot, dgleich, buda Differential Revision: https://phabricator.memgraph.io/D56 --- init.sh | 20 +++++--------------- tests/concurrent/futex.cpp | 8 ++++++-- 2 files changed, 11 insertions(+), 17 deletions(-) diff --git a/init.sh b/init.sh index a93b7bc3f..8a3ac285f 100755 --- a/init.sh +++ b/init.sh @@ -1,21 +1,11 @@ #!/bin/bash -if ! type "wget" > /dev/null; then - echo >&2 "Please install wget or set it in your path. Aborting."; exit 1; -fi - -if ! type "git" > /dev/null; then - echo >&2 "Please install git or set it in your path. Aborting."; exit 1; -fi - -if ! type "cmake" > /dev/null; then - echo >&2 "Please install cmake or set it in your path. Aborting."; exit 1; -fi - -cd cmake -./setup.sh -cd .. +# install all dependencies on debian based operating systems +for pkg in wget git cmake uuid-dev clang-3.8; do + dpkg -s $pkg 2>/dev/null >/dev/null || sudo apt-get -y install $pkg +done +# setup libs (download) cd libs ./setup.sh cd .. diff --git a/tests/concurrent/futex.cpp b/tests/concurrent/futex.cpp index bc26fc7c6..7a7070de1 100644 --- a/tests/concurrent/futex.cpp +++ b/tests/concurrent/futex.cpp @@ -9,12 +9,16 @@ Futex futex; int x = 0; -void test_lock(int id) { +/** + * @param thread id + */ +void test_lock(int) { std::random_device rd; std::mt19937 gen(rd()); std::uniform_int_distribution<> dis(0, 1000); - for (int i = 0; i < 5000000; ++i) { + // TODO: create long running test + for (int i = 0; i < 5; ++i) { { std::unique_lock guard(futex); x++;