Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#2968 backport #2977

Merged
merged 4 commits into from
Oct 24, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 28 additions & 7 deletions contrib/test_jenkins.sh
Original file line number Diff line number Diff line change
Expand Up @@ -712,9 +712,12 @@ run_coverity() {

#
# Run the test suite (gtest)
# Arguments: <compiler-name> [configure-flags]
#
run_gtest() {
../contrib/configure-devel --prefix=$ucx_inst
compiler_name=$1
shift
../contrib/configure-devel --prefix=$ucx_inst $@
$MAKE clean
$MAKE

Expand All @@ -739,11 +742,11 @@ run_gtest() {

mkdir -p $GTEST_REPORT_DIR

echo "==== Running unit tests ===="
echo "==== Running unit tests, $compiler_name compiler ===="
$AFFINITY $TIMEOUT make -C test/gtest test
(cd test/gtest && rename .tap _gtest.tap *.tap && mv *.tap $GTEST_REPORT_DIR)

echo "==== Running malloc hooks mallopt() test ===="
echo "==== Running malloc hooks mallopt() test, $compiler_name compiler ===="
# gtest returns with non zero exit code if there were no
# tests to run. As a workaround run a single test on every
# shard.
Expand All @@ -757,7 +760,7 @@ run_gtest() {
make -C test/gtest test
(cd test/gtest && rename .tap _mallopt_gtest.tap malloc_hook_cplusplus.tap && mv *.tap $GTEST_REPORT_DIR)

echo "==== Running malloc hooks mmap_ptrs test with MMAP_THRESHOLD=16384 ===="
echo "==== Running malloc hooks mmap_ptrs test with MMAP_THRESHOLD=16384, $compiler_name compiler ===="
$AFFINITY $TIMEOUT \
env MALLOC_MMAP_THRESHOLD_=16384 \
GTEST_SHARD_INDEX=0 \
Expand All @@ -768,7 +771,7 @@ run_gtest() {

if ! [[ $(uname -m) =~ "aarch" ]] && ! [[ $(uname -m) =~ "ppc" ]]
then
echo "==== Running valgrind tests ===="
echo "==== Running valgrind tests, $compiler_name compiler ===="

# Load newer valgrind if naative is older than 3.10
if ! (echo "valgrind-3.10.0"; valgrind --version) | sort -CV
Expand All @@ -782,12 +785,29 @@ run_gtest() {
(cd test/gtest && rename .tap _vg.tap *.tap && mv *.tap $GTEST_REPORT_DIR)
module unload tools/valgrind-latest
else
echo "==== Not running valgrind tests ===="
echo "==== Not running valgrind tests with $compiler_name compiler ===="
echo "1..1" > vg_skipped.tap
echo "ok 1 - # SKIP because running on $(uname -m)" >> vg_skipped.tap
fi
}

run_gtest_default() {
run_gtest "default"
}

run_gtest_armclang() {
if module_load arm-compiler/arm-hpc-compiler && armclang -v
then
run_gtest "armclang" CC=armclang CXX=armclang++
else
echo "==== Not running with armclang compiler ===="
echo "1..1" > armclang_skipped.tap
echo "ok 1 - # SKIP because armclang not found" >> armclang_skipped.tap
fi
module unload arm-compiler/arm-hpc-compiler
}


#
# Run the test suite (gtest) in release configuration
#
Expand Down Expand Up @@ -857,7 +877,8 @@ run_tests() {
do_distributed_task 0 4 test_unused_env_var

# all are running gtest
run_gtest
run_gtest_default
run_gtest_armclang

do_distributed_task 3 4 run_coverity
do_distributed_task 0 4 run_gtest_release
Expand Down
2 changes: 1 addition & 1 deletion src/ucs/datastruct/queue.h
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ static inline void ucs_queue_splice(ucs_queue_head_t *queue,
#define ucs_queue_for_each(elem, queue, member) \
for (*(queue)->ptail = NULL, \
elem = ucs_container_of((queue)->head, typeof(*elem), member); \
&elem->member != NULL; \
(elem) != ucs_container_of(NULL, typeof(*elem), member); \
elem = ucs_container_of(elem->member.next, typeof(*elem), member))

/**
Expand Down
28 changes: 9 additions & 19 deletions test/gtest/ucs/test_datatype.cc
Original file line number Diff line number Diff line change
Expand Up @@ -147,27 +147,17 @@ UCS_TEST_F(test_datatype, queue) {

UCS_TEST_F(test_datatype, queue_iter) {

const int num_elems = 4;
ucs_queue_head_t head;
elem_t *elem1, *elem2, *elem3, *elem4;
std::vector<elem_t> elems(num_elems);

ucs_queue_head_init(&head);
EXPECT_TRUE(ucs_queue_is_empty(&head));

elem1 = (elem_t*)malloc(sizeof(elem_t));
elem2 = (elem_t*)malloc(sizeof(elem_t));
elem3 = (elem_t*)malloc(sizeof(elem_t));
elem4 = (elem_t*)malloc(sizeof(elem_t));

elem1->i = 1;
elem2->i = 2;
elem3->i = 3;
elem4->i = 4;

ucs_queue_push(&head, &elem1->queue);
ucs_queue_push(&head, &elem2->queue);
ucs_queue_push(&head, &elem3->queue);
ucs_queue_push(&head, &elem4->queue);

for (int i = 0; i < num_elems; ++i) {
elems[i].i = i + 1;
ucs_queue_push(&head, &elems[i].queue);
}

{
std::vector<int> vec;
Expand All @@ -176,7 +166,7 @@ UCS_TEST_F(test_datatype, queue_iter) {
ucs_queue_for_each(elem, &head, queue) {
vec.push_back(elem->i);
}
ASSERT_EQ(4u, vec.size());
ASSERT_EQ(static_cast<size_t>(num_elems), vec.size());
EXPECT_EQ(1, vec[0]);
EXPECT_EQ(2, vec[1]);
EXPECT_EQ(3, vec[2]);
Expand All @@ -192,15 +182,15 @@ UCS_TEST_F(test_datatype, queue_iter) {
{
if (elem->i == 3 || elem->i == 4) {
ucs_queue_del_iter(&head, iter);
free(elem);
memset(elem, 0xff, sizeof(*elem));
}
}
ASSERT_EQ((unsigned long)2, ucs_queue_length(&head));

ucs_queue_for_each_safe(elem, iter, &head, queue) {
vec.push_back(elem->i);
ucs_queue_del_iter(&head, iter);
free(elem);
memset(elem, 0xff, sizeof(*elem));
}
ASSERT_EQ(2u, vec.size());
EXPECT_EQ(1, vec[0]);
Expand Down