summaryrefslogtreecommitdiff
path: root/storage/maria/unittest
diff options
context:
space:
mode:
Diffstat (limited to 'storage/maria/unittest')
-rw-r--r--storage/maria/unittest/lockman2-t.c21
-rw-r--r--storage/maria/unittest/ma_control_file-t.c12
-rw-r--r--storage/maria/unittest/trnman-t.c5
3 files changed, 22 insertions, 16 deletions
diff --git a/storage/maria/unittest/lockman2-t.c b/storage/maria/unittest/lockman2-t.c
index 2a8090ab9ac..01af1a03d22 100644
--- a/storage/maria/unittest/lockman2-t.c
+++ b/storage/maria/unittest/lockman2-t.c
@@ -171,10 +171,12 @@ void run_test(const char *test, pthread_handler handler, int n, int m)
static void reinit_tlo(TABLOCKMAN *lm, TABLE_LOCK_OWNER *lo)
{
+#ifdef NOT_USED_YET
TABLE_LOCK_OWNER backup= *lo;
+#endif
tablockman_release_locks(lm, lo);
- /*
+#ifdef NOT_USED_YET
pthread_mutex_destroy(lo->mutex);
pthread_cond_destroy(lo->cond);
bzero(lo, sizeof(*lo));
@@ -183,7 +185,8 @@ static void reinit_tlo(TABLOCKMAN *lm, TABLE_LOCK_OWNER *lo)
lo->cond= backup.cond;
lo->loid= backup.loid;
pthread_mutex_init(lo->mutex, MY_MUTEX_INIT_FAST);
- pthread_cond_init(lo->cond, 0);*/
+ pthread_cond_init(lo->cond, 0);
+#endif
}
pthread_mutex_t rt_mutex;
@@ -191,8 +194,8 @@ int Nrows= 100;
int Ntables= 10;
int table_lock_ratio= 10;
enum lock_type lock_array[6]= {S, X, LS, LX, IS, IX};
-char *lock2str[6]= {"S", "X", "LS", "LX", "IS", "IX"};
-char *res2str[]= {
+const char *lock2str[6]= {"S", "X", "LS", "LX", "IS", "IX"};
+const char *res2str[]= {
0,
"OUT OF MEMORY",
"DEADLOCK",
@@ -200,6 +203,7 @@ char *res2str[]= {
"GOT THE LOCK",
"GOT THE LOCK NEED TO LOCK A SUBRESOURCE",
"GOT THE LOCK NEED TO INSTANT LOCK A SUBRESOURCE"};
+
pthread_handler_t test_lockman(void *arg)
{
int m= (*(int *)arg);
@@ -215,13 +219,16 @@ pthread_handler_t test_lockman(void *arg)
for (x= ((int)(intptr)(&m)); m > 0; m--)
{
- x= (x*3628273133 + 1500450271) % 9576890767; /* three prime numbers */
+ /* three prime numbers */
+ x= (uint) ((x*LL(3628273133) + LL(1500450271)) % LL(9576890767));
row= x % Nrows + Ntables;
table= row % Ntables;
locklevel= (x/Nrows) & 3;
if (table_lock_ratio && (x/Nrows/4) % table_lock_ratio == 0)
- { /* table lock */
- res= tablockman_getlock(&tablockman, lo1, ltarray+table, lock_array[locklevel]);
+ {
+ /* table lock */
+ res= tablockman_getlock(&tablockman, lo1, ltarray+table,
+ lock_array[locklevel]);
DIAG(("loid %2d, table %d, lock %s, res %s", loid, table,
lock2str[locklevel], res2str[res]));
if (res < GOT_THE_LOCK)
diff --git a/storage/maria/unittest/ma_control_file-t.c b/storage/maria/unittest/ma_control_file-t.c
index beb86843dd3..49575378c78 100644
--- a/storage/maria/unittest/ma_control_file-t.c
+++ b/storage/maria/unittest/ma_control_file-t.c
@@ -42,7 +42,7 @@ char file_name[FN_REFLEN];
LSN expect_checkpoint_lsn;
uint32 expect_logno;
-static int delete_file();
+static int delete_file(myf my_flags);
/*
Those are test-specific wrappers around the module's API functions: after
calling the module's API functions they perform checks on the result.
@@ -91,7 +91,7 @@ int main(int argc,char *argv[])
get_options(argc,argv);
diag("Deleting control file at startup, if there is an old one");
- RET_ERR_UNLESS(0 == delete_file()); /* if fails, can't continue */
+ RET_ERR_UNLESS(0 == delete_file(0)); /* if fails, can't continue */
diag("Tests of normal conditions");
ok(0 == test_one_log(), "test of creating one log");
@@ -111,7 +111,7 @@ int main(int argc,char *argv[])
}
-static int delete_file()
+static int delete_file(myf my_flags)
{
RET_ERR_UNLESS(fn_format(file_name, CONTROL_FILE_BASE_NAME,
maria_data_root, "", MYF(MY_WME)) != NullS);
@@ -119,7 +119,7 @@ static int delete_file()
Maybe file does not exist, ignore error.
The error will however be printed on stderr.
*/
- my_delete(file_name, MYF(MY_WME));
+ my_delete(file_name, my_flags);
expect_checkpoint_lsn= CONTROL_FILE_IMPOSSIBLE_LSN;
expect_logno= CONTROL_FILE_IMPOSSIBLE_FILENO;
@@ -365,7 +365,7 @@ static int test_bad_size()
int fd;
/* A too short file */
- RET_ERR_UNLESS(delete_file() == 0);
+ RET_ERR_UNLESS(delete_file(MYF(MY_WME)) == 0);
RET_ERR_UNLESS((fd= my_open(file_name,
O_BINARY | O_RDWR | O_CREAT,
MYF(MY_WME))) >= 0);
@@ -378,7 +378,7 @@ static int test_bad_size()
RET_ERR_UNLESS(my_close(fd, MYF(MY_WME)) == 0);
/* Leave a correct control file */
- RET_ERR_UNLESS(delete_file() == 0);
+ RET_ERR_UNLESS(delete_file(MYF(MY_WME)) == 0);
RET_ERR_UNLESS(create_or_open_file() == CONTROL_FILE_OK);
RET_ERR_UNLESS(close_file() == 0);
diff --git a/storage/maria/unittest/trnman-t.c b/storage/maria/unittest/trnman-t.c
index 3c70d10c440..7d97794b685 100644
--- a/storage/maria/unittest/trnman-t.c
+++ b/storage/maria/unittest/trnman-t.c
@@ -35,7 +35,7 @@ int litmus;
pthread_handler_t test_trnman(void *arg)
{
int m= (*(int *)arg);
- uint x, y, i, j, n;
+ uint x, y, i, n;
TRN *trn[MAX_ITER];
pthread_mutex_t mutexes[MAX_ITER];
pthread_cond_t conds[MAX_ITER];
@@ -48,7 +48,7 @@ pthread_handler_t test_trnman(void *arg)
for (x= ((int)(intptr)(&m)); m > 0; )
{
- y= x= (x*3628273133 + 1500450271) % 9576890767; /* three prime numbers */
+ y= x= (x*LL(3628273133) + LL(1500450271)) % LL(9576890767); /* three prime numbers */
m-= n= x % MAX_ITER;
for (i= 0; i < n; i++)
{
@@ -65,7 +65,6 @@ pthread_handler_t test_trnman(void *arg)
trnman_end_trn(trn[i], y & 1);
}
}
-end:
for (i= 0; i < MAX_ITER; i++)
{
pthread_mutex_destroy(&mutexes[i]);