From f89147e91cccf7bd625260104c87acc0bae2449e Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Thu, 1 Nov 2012 17:50:24 -0400 Subject: [PATCH] Add multiflavor test program Add a multiflavor test program to catch symbol name clashes earlier next time. Signed-off-by: Mathieu Desnoyers --- tests/Makefile.am | 22 ++++++++++++- tests/runall.sh | 4 +++ tests/test_urcu_multiflavor-bp.c | 38 +++++++++++++++++++++ tests/test_urcu_multiflavor-mb.c | 38 +++++++++++++++++++++ tests/test_urcu_multiflavor-memb.c | 37 +++++++++++++++++++++ tests/test_urcu_multiflavor-qsbr.c | 37 +++++++++++++++++++++ tests/test_urcu_multiflavor-signal.c | 38 +++++++++++++++++++++ tests/test_urcu_multiflavor.c | 49 ++++++++++++++++++++++++++++ 8 files changed, 262 insertions(+), 1 deletion(-) create mode 100644 tests/test_urcu_multiflavor-bp.c create mode 100644 tests/test_urcu_multiflavor-mb.c create mode 100644 tests/test_urcu_multiflavor-memb.c create mode 100644 tests/test_urcu_multiflavor-qsbr.c create mode 100644 tests/test_urcu_multiflavor-signal.c create mode 100644 tests/test_urcu_multiflavor.c diff --git a/tests/Makefile.am b/tests/Makefile.am index df22d06..b029377 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -19,7 +19,8 @@ noinst_PROGRAMS = test_urcu test_urcu_dynamic_link test_urcu_timing \ test_urcu_wfq_dynlink test_urcu_wfs_dynlink \ test_urcu_wfcq_dynlink \ test_urcu_lfq_dynlink test_urcu_lfs_dynlink test_urcu_hash \ - test_urcu_lfs_rcu_dynlink + test_urcu_lfs_rcu_dynlink \ + test_urcu_multiflavor test_urcu_multiflavor_dynlink noinst_HEADERS = rcutorture.h if COMPAT_ARCH @@ -206,6 +207,25 @@ test_urcu_hash_SOURCES = test_urcu_hash.c test_urcu_hash.h \ test_urcu_hash_CFLAGS = -DRCU_QSBR $(AM_CFLAGS) test_urcu_hash_LDADD = $(URCU_QSBR_LIB) $(URCU_CDS_LIB) +test_urcu_multiflavor_SOURCES = test_urcu_multiflavor.c \ + test_urcu_multiflavor-memb.c \ + test_urcu_multiflavor-mb.c \ + test_urcu_multiflavor-signal.c \ + test_urcu_multiflavor-qsbr.c \ + test_urcu_multiflavor-bp.c +test_urcu_multiflavor_LDADD = $(URCU_LIB) $(URCU_MB_LIB) \ + $(URCU_SIGNAL_LIB) $(URCU_QSBR_LIB) $(URCU_BP_LIB) + +test_urcu_multiflavor_dynlink_SOURCES = test_urcu_multiflavor.c \ + test_urcu_multiflavor-memb.c \ + test_urcu_multiflavor-mb.c \ + test_urcu_multiflavor-signal.c \ + test_urcu_multiflavor-qsbr.c \ + test_urcu_multiflavor-bp.c +test_urcu_multiflavor_dynlink_CFLAGS = -DDYNAMIC_LINK_TEST $(AM_CFLAGS) +test_urcu_multiflavor_dynlink_LDADD = $(URCU_LIB) $(URCU_MB_LIB) \ + $(URCU_SIGNAL_LIB) $(URCU_QSBR_LIB) $(URCU_BP_LIB) + urcutorture.c: api.h check-am: diff --git a/tests/runall.sh b/tests/runall.sh index 6072aca..8d9d653 100755 --- a/tests/runall.sh +++ b/tests/runall.sh @@ -100,5 +100,9 @@ for READERCSLEN in ${READERCSLEN_ARRAY}; do ./runtests.sh ${NR_READERS} ${NR_WRITERS} ${DURATION} ${EXTRA_OPTS} -c ${READERCSLEN} | tee -a readercslen.log done +echo Executing multi-flavor RCU test +./test_urcu_multiflavor +./test_urcu_multiflavor_dynlink + echo Executing Hash table test ./runhash.sh diff --git a/tests/test_urcu_multiflavor-bp.c b/tests/test_urcu_multiflavor-bp.c new file mode 100644 index 0000000..c9f00a3 --- /dev/null +++ b/tests/test_urcu_multiflavor-bp.c @@ -0,0 +1,38 @@ +/* + * test_urcu_multiflavor-bp.c + * + * Userspace RCU library - test multiple RCU flavors into one program + * + * Copyright February 2012 - Mathieu Desnoyers + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifndef DYNAMIC_LINK_TEST +#define _LGPL_SOURCE +#endif + +#define RCU_SIGNAL +#include + +int test_mf_bp(void) +{ + rcu_register_thread(); + rcu_read_lock(); + rcu_read_unlock(); + synchronize_rcu(); + rcu_unregister_thread(); + return 0; +} diff --git a/tests/test_urcu_multiflavor-mb.c b/tests/test_urcu_multiflavor-mb.c new file mode 100644 index 0000000..5b5d7e4 --- /dev/null +++ b/tests/test_urcu_multiflavor-mb.c @@ -0,0 +1,38 @@ +/* + * test_urcu_multiflavor-mb.c + * + * Userspace RCU library - test multiple RCU flavors into one program + * + * Copyright February 2012 - Mathieu Desnoyers + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifndef DYNAMIC_LINK_TEST +#define _LGPL_SOURCE +#endif + +#define RCU_MB +#include + +int test_mf_mb(void) +{ + rcu_register_thread(); + rcu_read_lock(); + rcu_read_unlock(); + synchronize_rcu(); + rcu_unregister_thread(); + return 0; +} diff --git a/tests/test_urcu_multiflavor-memb.c b/tests/test_urcu_multiflavor-memb.c new file mode 100644 index 0000000..c3a0128 --- /dev/null +++ b/tests/test_urcu_multiflavor-memb.c @@ -0,0 +1,37 @@ +/* + * test_urcu_multiflavor-memb.c + * + * Userspace RCU library - test multiple RCU flavors into one program + * + * Copyright February 2012 - Mathieu Desnoyers + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifndef DYNAMIC_LINK_TEST +#define _LGPL_SOURCE +#endif + +#include + +int test_mf_memb(void) +{ + rcu_register_thread(); + rcu_read_lock(); + rcu_read_unlock(); + synchronize_rcu(); + rcu_unregister_thread(); + return 0; +} diff --git a/tests/test_urcu_multiflavor-qsbr.c b/tests/test_urcu_multiflavor-qsbr.c new file mode 100644 index 0000000..f4fb145 --- /dev/null +++ b/tests/test_urcu_multiflavor-qsbr.c @@ -0,0 +1,37 @@ +/* + * test_urcu_multiflavor-qsbr.c + * + * Userspace RCU library - test multiple RCU flavors into one program + * + * Copyright February 2012 - Mathieu Desnoyers + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifndef DYNAMIC_LINK_TEST +#define _LGPL_SOURCE +#endif + +#include + +int test_mf_qsbr(void) +{ + rcu_register_thread(); + rcu_read_lock(); + rcu_read_unlock(); + synchronize_rcu(); + rcu_unregister_thread(); + return 0; +} diff --git a/tests/test_urcu_multiflavor-signal.c b/tests/test_urcu_multiflavor-signal.c new file mode 100644 index 0000000..5519d36 --- /dev/null +++ b/tests/test_urcu_multiflavor-signal.c @@ -0,0 +1,38 @@ +/* + * test_urcu_multiflavor-signal.c + * + * Userspace RCU library - test multiple RCU flavors into one program + * + * Copyright February 2012 - Mathieu Desnoyers + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifndef DYNAMIC_LINK_TEST +#define _LGPL_SOURCE +#endif + +#define RCU_SIGNAL +#include + +int test_mf_signal(void) +{ + rcu_register_thread(); + rcu_read_lock(); + rcu_read_unlock(); + synchronize_rcu(); + rcu_unregister_thread(); + return 0; +} diff --git a/tests/test_urcu_multiflavor.c b/tests/test_urcu_multiflavor.c new file mode 100644 index 0000000..825333e --- /dev/null +++ b/tests/test_urcu_multiflavor.c @@ -0,0 +1,49 @@ +/* + * test_urcu_multiflavor.c + * + * Userspace RCU library - test multiple RCU flavors into one program + * + * Copyright February 2012 - Mathieu Desnoyers + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#include + +int main(int argc, char **argv) +{ + int ret; + + ret = test_mf_memb(); + if (ret) + goto failure; + ret = test_mf_mb(); + if (ret) + goto failure; + ret = test_mf_signal(); + if (ret) + goto failure; + ret = test_mf_qsbr(); + if (ret) + goto failure; + ret = test_mf_bp(); + if (ret) + goto failure; + + exit(EXIT_SUCCESS); + +failure: + exit(EXIT_FAILURE); +} -- 2.34.1