From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id DCBF7266F7 for ; Sat, 9 Jun 2018 17:22:37 -0400 (EDT) Received: from turing.freelists.org ([127.0.0.1]) by localhost (turing.freelists.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id XADd2fz_V5JZ for ; Sat, 9 Jun 2018 17:22:37 -0400 (EDT) Received: from smtp54.i.mail.ru (smtp54.i.mail.ru [217.69.128.34]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTPS id 3A15A266F6 for ; Sat, 9 Jun 2018 17:22:37 -0400 (EDT) Subject: [tarantool-patches] Re: [PATCH v7 1/1] box: create bigrefs for tuples References: <1d9d86e84669c700adf694a8178f7133a52e9262.1528555089.git.imeevma@gmail.com> <9185aed4-3f3e-6548-b210-ebf400114fe0@tarantool.org> <1528569664.354142726@f492.i.mail.ru> From: Vladislav Shpilevoy Message-ID: <6c43e17e-55aa-e3d5-914b-cd03056becdf@tarantool.org> Date: Sun, 10 Jun 2018 00:22:33 +0300 MIME-Version: 1.0 In-Reply-To: <1528569664.354142726@f492.i.mail.ru> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: tarantool-patches-bounce@freelists.org Errors-to: tarantool-patches-bounce@freelists.org Reply-To: tarantool-patches@freelists.org List-help: List-unsubscribe: List-software: Ecartis version 1.0.0 List-Id: tarantool-patches List-subscribe: List-owner: List-post: List-archive: To: tarantool-patches@freelists.org, =?UTF-8?B?0JzQtdGA0LPQtdC9INCY0LzQtdC1?= =?UTF-8?B?0LI=?= Hello. Thanks for the fixes! I have force pushed my new fixes for the test. They are about unit.h usage. With plan() + header() you can create enclosed tests, so in a unit test you would not use printf() directly. Now the patch LGTM to me again. Please, send a new version to Vladimir. diff --git a/test/unit/tuple_bigref.c b/test/unit/tuple_bigref.c index 154c10ac1..973bf924a 100644 --- a/test/unit/tuple_bigref.c +++ b/test/unit/tuple_bigref.c @@ -43,9 +43,10 @@ create_tuple() * consistently. */ static void -test_bigrefs_1() +test_bigrefs_overall() { - printf("Test1: Overall check of bigrefs.\n"); + header(); + plan(3); uint16_t counter = 0; struct tuple **tuples = (struct tuple **) malloc(BIGREF_CAPACITY * sizeof(*tuples)); @@ -74,6 +75,8 @@ test_bigrefs_1() } is(counter, BIGREF_CAPACITY, "All tuples were deleted."); free(tuples); + footer(); + check_plan(); } /** @@ -81,9 +84,10 @@ test_bigrefs_1() * created and destroyed 2 times. */ static void -test_bigrefs_2() +test_bigrefs_create_destroy() { - printf("Test 2: Create/destroy test.\n"); + header(); + plan(2); struct tuple *tuple = create_tuple(); for(int j = 1; j < BIGREF_COUNT; ++j) tuple_ref(tuple); @@ -98,6 +102,8 @@ test_bigrefs_2() for(int j = 1; j < BIGREF_COUNT; ++j) tuple_unref(tuple); tuple_unref(tuple); + footer(); + check_plan(); } /** @@ -105,15 +111,16 @@ test_bigrefs_2() * intended. */ static void -test_bigrefs_3() +test_bigrefs_non_consistent() { - printf("Test3: Non-consistent indexes test.\n"); + header(); + plan(3); uint16_t counter = 0; uint16_t max_index = BIGREF_CAPACITY / BIGREF_DIFF; struct tuple **tuples = (struct tuple **) malloc(BIGREF_CAPACITY * sizeof(*tuples)); - uint16_t *indexes = (uint16_t *) malloc (sizeof(*indexes) * - (max_index + 1)); + uint16_t *indexes = (uint16_t *) malloc(sizeof(*indexes) * + (max_index + 1)); for(int i = 0; i < BIGREF_CAPACITY; ++i) tuples[i] = create_tuple(); for(int i = 0; i < BIGREF_CAPACITY; ++i) { @@ -151,13 +158,15 @@ test_bigrefs_3() } free(indexes); free(tuples); + footer(); + check_plan(); } int main() { header(); - plan(9); + plan(3); memory_init(); fiber_init(fiber_c_invoke); @@ -166,9 +175,9 @@ main() tuple_end = mp_encode_array(tuple_end, 1); tuple_end = mp_encode_uint(tuple_end, 2); - test_bigrefs_1(); - test_bigrefs_2(); - test_bigrefs_3(); + test_bigrefs_overall(); + test_bigrefs_create_destroy(); + test_bigrefs_non_consistent(); tuple_free(); fiber_free(); diff --git a/test/unit/tuple_bigref.result b/test/unit/tuple_bigref.result index 7e8694e15..74da2d559 100644 --- a/test/unit/tuple_bigref.result +++ b/test/unit/tuple_bigref.result @@ -1,15 +1,23 @@ -# Looks like you planned 9 tests but ran 8. *** main *** -1..9 -Test1: Overall check of bigrefs. -ok 1 - All tuples have refs == 1. -ok 2 - All tuples have bigrefs. -ok 3 - All tuples were deleted. -Test 2: Create/destroy test. -ok 4 - Tuple becomes bigref first time with ref_index == 0. -ok 5 - Tuple becomes bigref second time with ref_index == 0. -Test3: Non-consistent indexes test. -ok 6 - All tuples have bigrefs. -ok 7 - 11 tuples don't have bigrefs and all other tuples have -ok 8 - All tuples have bigrefs and their indexes are in right order. +1..3 + *** test_bigrefs_overall *** + 1..3 + ok 1 - All tuples have refs == 1. + ok 2 - All tuples have bigrefs. + ok 3 - All tuples were deleted. + *** test_bigrefs_overall: done *** +ok 1 - subtests + *** test_bigrefs_create_destroy *** + 1..2 + ok 1 - Tuple becomes bigref first time with ref_index == 0. + ok 2 - Tuple becomes bigref second time with ref_index == 0. + *** test_bigrefs_create_destroy: done *** +ok 2 - subtests + *** test_bigrefs_non_consistent *** + 1..3 + ok 1 - All tuples have bigrefs. + ok 2 - 11 tuples don't have bigrefs and all other tuples have + ok 3 - All tuples have bigrefs and their indexes are in right order. + *** test_bigrefs_non_consistent: done *** +ok 3 - subtests *** main: done ***