From 59294fb5710778a668ae03752d668f945728c60e Mon Sep 17 00:00:00 2001 From: Michael Widenius <monty@mysql.com> Date: Wed, 4 Jun 2008 12:39:54 +0300 Subject: [PATCH] Fixed failing trnman-t unit test mysql-test/valgrind.supp: Fixed suppression rule storage/maria/unittest/trnman-t.c: Test failed becasue it accessed reused structures. I fixed this by creating a separate array to hold trids for the transactions --- mysql-test/valgrind.supp | 2 +- storage/maria/unittest/trnman-t.c | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/mysql-test/valgrind.supp b/mysql-test/valgrind.supp index e3ef8907d9b..f06cdd6d547 100644 --- a/mysql-test/valgrind.supp +++ b/mysql-test/valgrind.supp @@ -384,7 +384,7 @@ fun:calloc fun:_dlerror_run fun:dlclose - fun:plugin_dl_del + fun:plugin_dl_del(st_mysql_lex_string const*) } { diff --git a/storage/maria/unittest/trnman-t.c b/storage/maria/unittest/trnman-t.c index 7aa98462740..439df10e66e 100644 --- a/storage/maria/unittest/trnman-t.c +++ b/storage/maria/unittest/trnman-t.c @@ -111,10 +111,11 @@ void run_test(const char *test, pthread_handler handler, int n, int m) } #define ok_read_from(T1, T2, RES) \ - i= trnman_can_read_from(trn[T1], trn[T2]->trid); \ + i= trnman_can_read_from(trn[T1], trid[T2]); \ ok(i == RES, "trn" #T1 " %s read from trn" #T2, i ? "can" : "cannot") #define start_transaction(T) \ - trn[T]= trnman_new_trn(&mutexes[T], &conds[T], &i + STACK_SIZE) + trn[T]= trnman_new_trn(&mutexes[T], &conds[T], &i + STACK_SIZE); \ + trid[T]= trn[T]->trid #define commit(T) trnman_commit_trn(trn[T]) #define abort(T) trnman_abort_trn(trn[T]) @@ -122,6 +123,7 @@ void run_test(const char *test, pthread_handler handler, int n, int m) void test_trnman_read_from() { TRN *trn[Ntrns]; + TrID trid[Ntrns]; pthread_mutex_t mutexes[Ntrns]; pthread_cond_t conds[Ntrns]; int i; @@ -142,6 +144,7 @@ void test_trnman_read_from() ok_read_from(3, 0, 1); ok_read_from(3, 1, 0); ok_read_from(3, 2, 0); + ok_read_from(3, 3, 1); commit(1); /* commit trn2 */ ok_read_from(3, 1, 0); commit(3); /* commit trn5 */ @@ -158,7 +161,7 @@ int main(int argc __attribute__((unused)), char **argv) MY_INIT(argv[0]); my_init(); - plan(6); + plan(7); if (my_atomic_initialize()) return exit_status(); -- 2.30.9