[SCM] CTDB repository - branch master updated - ctdb-1.13-147-ge9fad1f

Ronnie Sahlberg sahlberg at samba.org
Mon Apr 30 03:33:05 MDT 2012


The branch, master has been updated
       via  e9fad1ff82e6fb9e6bf615986c41c746fd415058 (commit)
       via  a0afb4195caab39891a304b8b4eadd94cab7c4a7 (commit)
       via  66d0b913301c3b1037278bcaa0452ecbe07248df (commit)
       via  1c37abac5fd18c139aa55989d0fb6b475f4c22f1 (commit)
       via  047d97dc84a5943556efb31bb2856fd04835fffa (commit)
       via  0c674efd19368d41d9cc28909d2b16c1af54c86c (commit)
       via  df732ca8e27f0f3417b4d5d259157bd0e0632124 (commit)
       via  12c9986059cacda819e669fa77d613b408c62599 (commit)
       via  eddfc02335202d853e29a89f08225ab44cac8a25 (commit)
       via  3219f221a858e499f084b8beb44610537312602b (commit)
       via  b430a5f61cfdc28e967890602ce6dac0e922c07d (commit)
       via  734cbd7def23236d418ebc6d813a748a84900101 (commit)
       via  78f6f209eb15102f4e8baa9106583df0ef4bb693 (commit)
       via  e6bfd3bdb3a35b2e7e7c41a6f37976772a54e3ce (commit)
       via  301491802eec0e49e108f5aae7d7be379703d72c (commit)
       via  8e4ec9a40bb7d392d7474b067a74fa121c069007 (commit)
       via  4aa879466dd46cb4e8710edbbaac1276521e475b (commit)
       via  709cd5dfeb630096a1cd2062da666fee9ddca715 (commit)
       via  fbabc05569d91bf033f474d89f51b49490943332 (commit)
       via  246809af64c03d26288abff5907ed46614e72b15 (commit)
       via  bef03b32f8ec114a64c55b25951aeeb939d87b33 (commit)
       via  95947123eee687ed83eebc567397a5bc9d55a945 (commit)
       via  6eb7fa572e7fc212332ddd68793e3f35161baf7c (commit)
       via  704a3e3b83aff63e8f7b0650c141776ed2c1f047 (commit)
       via  79e979d67e3a2a5a13ef8fd2ef8f56331ec51558 (commit)
       via  a0a7759d47ef5de4a8214273e39c50fb1f6e2e0c (commit)
       via  eef162ceaac6853bf1ff622691901289280bc25f (commit)
       via  d714cf7924674a7a0eb6d585eb74a6a4df26fc12 (commit)
       via  dc71294a33e88baa4e85fa1fa66cab58a83c2607 (commit)
       via  f45295a3005474957852d0e7a5c3807e30ab519d (commit)
       via  6136ab02db261b26a2a58b526c913e37e8146841 (commit)
       via  b5308142d03332d6d4e0c3b77283c772462fbb23 (commit)
       via  66a7fece867966528689d2784a284e32d687a0f5 (commit)
       via  72ecae61c43b318ec94b527a12cbb0a382e8c3db (commit)
       via  9542e770a9780740b49122f1f52f08b32eca4b35 (commit)
       via  bfa1d6638d3e116640eb4e3bb71b21ba6ef8cae5 (commit)
       via  79adb50b3ce3873c3baf9e6715c1d1c3f181ce43 (commit)
      from  8052ee0a6bda3fa88501d77b2d53315be2b75ec1 (commit)

http://gitweb.samba.org/?p=ctdb.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit e9fad1ff82e6fb9e6bf615986c41c746fd415058
Author: Martin Schwenke <martin at meltin.net>
Date:   Fri Apr 27 17:19:45 2012 +1000

    tests: Update README
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>

commit a0afb4195caab39891a304b8b4eadd94cab7c4a7
Author: Martin Schwenke <martin at meltin.net>
Date:   Fri Apr 27 14:17:52 2012 +1000

    tests/eventscripts: $CTDB_ETCDIR should be in $TEST_VAR_DIR
    
    The policy routing tests modify /etc/iproute2/rt_tables, so this
    directory should not be in the installation area.
    
    Instead the contents of tests/eventscripts/etc are copied into a place
    under $TEST_VAR_DIR where the directory can be modified with gay
    abandon.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>

commit 66d0b913301c3b1037278bcaa0452ecbe07248df
Author: Martin Schwenke <martin at meltin.net>
Date:   Fri Apr 27 14:16:16 2012 +1000

    tests/eventscripts: Use a canned ctdb.sysconfig rather than a link
    
    The link is hard to manage and has no real advantage.
    
    The canned config is 2 of the 3 currently non-comment/whitespace lines
    in config/ctdb.sysconfig.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>

commit 1c37abac5fd18c139aa55989d0fb6b475f4c22f1
Author: Martin Schwenke <martin at meltin.net>
Date:   Fri Apr 27 14:15:06 2012 +1000

    tests/eventscripts: Explicitly set CTDB_SERVICE_AUTOSTARTSTOP="yes"
    
    No use depending on defaults in the initscript - the tests should
    control what is tested.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>

commit 047d97dc84a5943556efb31bb2856fd04835fffa
Author: Martin Schwenke <martin at meltin.net>
Date:   Tue Apr 24 17:17:59 2012 +1000

    tests/eventscripts: Be more defensive about removing the var directory
    
    Could add -r but that might avoid error.  The only time it doesn't
    exist is the 1st time a top-level var directory is used.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>

commit 0c674efd19368d41d9cc28909d2b16c1af54c86c
Author: Martin Schwenke <martin at meltin.net>
Date:   Tue Apr 24 17:17:07 2012 +1000

    Eventscripts: fix basename -> dirname typo
    
    I fixed one of these previously but didn't notice this one...  :-(
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>

commit df732ca8e27f0f3417b4d5d259157bd0e0632124
Author: Martin Schwenke <martin at meltin.net>
Date:   Tue Apr 24 16:59:38 2012 +1000

    tests/eventscripts: Add sanity check to esnure events.d/ can be found
    
    If it can't, the installation is probably inconsistent, so a
    (hopefully) helpful message is printed.  :-)
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>

commit 12c9986059cacda819e669fa77d613b408c62599
Author: Martin Schwenke <martin at meltin.net>
Date:   Tue Apr 24 16:28:15 2012 +1000

    tests: Add installation script for tests
    
    This could all be done in Makefile.in, but that would be very complex.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>

commit eddfc02335202d853e29a89f08225ab44cac8a25
Author: Martin Schwenke <martin at meltin.net>
Date:   Tue Apr 24 14:40:52 2012 +1000

    tests/simple: Add new pseudo testcase to potentially shutdown local daemons
    
    Only shuts them down if $TEST_CLEANUP is true.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>

commit 3219f221a858e499f084b8beb44610537312602b
Author: Martin Schwenke <martin at meltin.net>
Date:   Tue Apr 24 14:39:24 2012 +1000

    tests: New run_tests -C (cleanup) option
    
    Sets TEST_CLEANUP=true and causes $TEST_VAR_DIR to be removed... and
    potentially other cleanup actions in testcases.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>

commit b430a5f61cfdc28e967890602ce6dac0e922c07d
Author: Martin Schwenke <martin at meltin.net>
Date:   Tue Apr 24 14:04:36 2012 +1000

    tests/eventscripts: $FAKE_IP_STATE is always set in ip command stub
    
    No need for a default, especially since there is no sane default!
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>

commit 734cbd7def23236d418ebc6d813a748a84900101
Author: Martin Schwenke <martin at meltin.net>
Date:   Tue Apr 24 14:03:41 2012 +1000

    tests: Time logging in integration tests should use TEST_VAR_DIR
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>

commit 78f6f209eb15102f4e8baa9106583df0ef4bb693
Author: Martin Schwenke <martin at meltin.net>
Date:   Tue Apr 24 14:02:28 2012 +1000

    tests: Unit tests should use $TEST_VAR_DIR
    
    This directory is already guaranteed to be absolute, so no check is
    needed.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>

commit e6bfd3bdb3a35b2e7e7c41a6f37976772a54e3ce
Author: Martin Schwenke <martin at meltin.net>
Date:   Tue Apr 24 11:50:36 2012 +1000

    tests: Improve the logic for adding directories to $PATH
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>

commit 301491802eec0e49e108f5aae7d7be379703d72c
Author: Martin Schwenke <martin at meltin.net>
Date:   Tue Apr 24 11:39:07 2012 +1000

    tests: Update integration.sh to use TEST_VAR_DIR
    
    There are 2 subtleties:
    
    * Local daemons currently use the in-tree tests/events.d/ subdirectory
      for their eventscripts.  However, some tests install/remove test-specific
      eventscripts so now $TEST_VAR_DIR/events.d/ is used and the standard
      eventscripts are copied there at setup time.
    
    * The pgrep/pkill logic for killing local daemons currently relies on
      ctdbd being run with a full path to tests/bin/ctdbd.  If the tests
      are installed and run against an installed daemon then this won't
      work.  Therefore, ctdbd is now expected to be in $PATH and is
      found/killed by matching:
    
        ctdbd --socket=.* --nlist .* --nopublicipcheck
    
      This is complex but should avoid killing a real ctdbd running on a
      node.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>

commit 8e4ec9a40bb7d392d7474b067a74fa121c069007
Author: Martin Schwenke <martin at meltin.net>
Date:   Tue Apr 24 10:25:50 2012 +1000

    tests: Add a -V option to set new variable TEST_VAR_DIR
    
    Part of preparation to be able to install the tests.  The current var/
    subdirectories will end up somewhere in /usr/local/ or /usr/ and we
    don't want to put temporary files there.
    
    This creates a temporary TEST_VAR_DIR by default.
    
    If -V is specified then the given directory will be used as
    TEST_VAR_DIR.  This allows the current behaviour where individual
    integration tests can be run against already-running daemons 9with
    sockets and other stuff already created) to save time and trouble.
    
    Yes, there are plans for a clean-up option...  ;-)
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>

commit 4aa879466dd46cb4e8710edbbaac1276521e475b
Author: Martin Schwenke <martin at meltin.net>
Date:   Tue Apr 24 10:23:17 2012 +1000

    tests/integration: Remove cabability for testcase option
    
    This is unused and can't be used with the current test infrastructure.
    It may have been useful with ctdb_test_env but I don't think it was
    ever used.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>

commit 709cd5dfeb630096a1cd2062da666fee9ddca715
Author: Martin Schwenke <martin at meltin.net>
Date:   Mon Apr 23 14:45:04 2012 +1000

    tests/integration: Use absolute path for socket symlink
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>

commit fbabc05569d91bf033f474d89f51b49490943332
Author: Martin Schwenke <martin at meltin.net>
Date:   Mon Apr 23 14:40:28 2012 +1000

    tests/simple: Replace "tdbdump" with "ctdb cattdb"
    
    tdbdump may not be installed and would be an unnecessary dependency.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>

commit 246809af64c03d26288abff5907ed46614e72b15
Author: Martin Schwenke <martin at meltin.net>
Date:   Fri Apr 20 16:43:17 2012 +1000

    tests: Make run_tests -X more flexible - it now works with onnode
    
    Hardcoding "sh -x" is suboptimal because some scripts, like onnode,
    require bash.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>

commit bef03b32f8ec114a64c55b25951aeeb939d87b33
Author: Martin Schwenke <martin at meltin.net>
Date:   Fri Apr 20 16:37:09 2012 +1000

    tests: Update README files and add new README files where missing
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>

commit 95947123eee687ed83eebc567397a5bc9d55a945
Author: Martin Schwenke <martin at meltin.net>
Date:   Fri Apr 20 14:10:34 2012 +1000

    tests: Update top-level wrapper scripts
    
    * Add the unit tests to "make test"
    * Make scripts run from anywhere
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>

commit 6eb7fa572e7fc212332ddd68793e3f35161baf7c
Author: Martin Schwenke <martin at meltin.net>
Date:   Fri Apr 20 14:09:43 2012 +1000

    tests: run_tests should exit with failed test status if running with -H
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>

commit 704a3e3b83aff63e8f7b0650c141776ed2c1f047
Author: Martin Schwenke <martin at meltin.net>
Date:   Fri Apr 20 13:57:01 2012 +1000

    tests: test_wrap can use $TEST_SCRIPTS_DIR for a little extra clarity
    
    Also add a comment to explain what is being added to $PATH.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>

commit 79e979d67e3a2a5a13ef8fd2ef8f56331ec51558
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Thu Apr 19 15:40:53 2012 +1000

    tests: test_wrap needs to set TEST_SCRIPTS_DIR
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>

commit a0a7759d47ef5de4a8214273e39c50fb1f6e2e0c
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Thu Apr 19 15:33:46 2012 +1000

    tests: CTDB_TEST_WRAPPER has to be an absolute path on a real cluster
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>

commit eef162ceaac6853bf1ff622691901289280bc25f
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Thu Apr 19 15:18:49 2012 +1000

    tests: Fix wrapper scripts
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>

commit d714cf7924674a7a0eb6d585eb74a6a4df26fc12
Author: Martin Schwenke <martin at meltin.net>
Date:   Thu Apr 19 12:19:02 2012 +1000

    tests: Fix trailing whitespace issues in integration.bash
    
    git complains...
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>

commit dc71294a33e88baa4e85fa1fa66cab58a83c2607
Author: Martin Schwenke <martin at meltin.net>
Date:   Thu Apr 19 12:10:25 2012 +1000

    tests: Add new -H option for run_tests to avoid printing header/footer
    
    This is useful for using run_tests to run one test at a time within an
    alternative test framework.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>

commit f45295a3005474957852d0e7a5c3807e30ab519d
Author: Martin Schwenke <martin at meltin.net>
Date:   Thu Apr 19 11:50:32 2012 +1000

    tests: Add -e option to cause run_tests to exit on first test failure
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>

commit 6136ab02db261b26a2a58b526c913e37e8146841
Author: Martin Schwenke <martin at meltin.net>
Date:   Thu Apr 19 11:31:02 2012 +1000

    tests: Remove ctdb_test_env
    
    Move the contents to integration.bash and run_tests as appropriate.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>

commit b5308142d03332d6d4e0c3b77283c772462fbb23
Author: Martin Schwenke <martin at meltin.net>
Date:   Thu Apr 19 11:27:05 2012 +1000

    tests: Programs run by tests should be found in $PATH
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>

commit 66a7fece867966528689d2784a284e32d687a0f5
Author: Martin Schwenke <martin at meltin.net>
Date:   Thu Apr 19 11:23:07 2012 +1000

    tests: Move relative directory path hack from run_tests to common.sh
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>

commit 72ecae61c43b318ec94b527a12cbb0a382e8c3db
Author: Martin Schwenke <martin at meltin.net>
Date:   Thu Apr 19 11:14:28 2012 +1000

    tests: Local daemons are no longer the default, now require run_tests -l
    
    Testing with local daemons is the current default but this is not the
    most common use case.  Therefore, we make local daemons optional by
    using the -l switch with run_tests or by setting TEST_LOCAL_DAEMONS to
    the number of daemons to be used (-l sets this to 3).
    
    TEST_LOCAL_DAEMONS replaces CTDB_TEST_NUM_DAEMONS and
    CTDB_TEST_REAL_CLUSTER is removed.
    
    Most relevant logic is moved from ctdb_test_env to integration.bash.
    ctdb_test_check_real_cluster() is moved from integration.bash to
    complex/scripts/local.bash.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>

commit 9542e770a9780740b49122f1f52f08b32eca4b35
Author: Martin Schwenke <martin at meltin.net>
Date:   Wed Apr 18 16:49:48 2012 +1000

    Eventscripts - Fix typo in 13.per_ip_routing support for __auto_link_local__
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>

commit bfa1d6638d3e116640eb4e3bb71b21ba6ef8cae5
Author: Martin Schwenke <martin at meltin.net>
Date:   Wed Apr 18 15:04:50 2012 +1000

    tests: Rationalise integration test infrastructure
    
    * run_tests no longer includes common.sh, which is only to be included
      by test cases.  Therefore, it defines its own die() function.
    
    * TEST_SUBDIR is now set in common.sh
    
    * Move complex-only functions to complex/scripts/local.bash
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>

commit 79adb50b3ce3873c3baf9e6715c1d1c3f181ce43
Author: Martin Schwenke <martin at meltin.net>
Date:   Wed Apr 18 14:55:21 2012 +1000

    tests: Rename ctdb_test_functions.bash to integration.bash
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>

-----------------------------------------------------------------------

Summary of changes:
 Makefile.in                                        |    4 +
 config/events.d/13.per_ip_routing                  |    4 +-
 tests/INSTALL                                      |   91 ++++++
 tests/README                                       |  142 +++++-----
 tests/complex/01_ctdb_nfs_skip_share_check.sh      |    2 +-
 tests/complex/02_ctdb_samba_skip_share_check.sh    |    2 +-
 tests/complex/11_ctdb_delip_removes_ip.sh          |    2 +-
 tests/complex/31_nfs_tickle.sh                     |    2 +-
 tests/complex/32_cifs_tickle.sh                    |    2 +-
 tests/complex/33_gratuitous_arp.sh                 |    2 +-
 tests/complex/41_failover_ping_discrete.sh         |    2 +-
 tests/complex/42_failover_ssh_hostname.sh          |    2 +-
 tests/complex/43_failover_nfs_basic.sh             |    2 +-
 tests/complex/44_failover_nfs_oneway.sh            |    2 +-
 tests/complex/README                               |    2 +
 tests/complex/scripts/local.bash                   |  139 +++++++++
 tests/eventscripts/50.samba.monitor.050.sh         |    1 +
 tests/eventscripts/50.samba.monitor.051.sh         |    1 +
 tests/eventscripts/README                          |   36 ++-
 tests/eventscripts/etc/sysconfig/ctdb              |    3 +-
 tests/eventscripts/scripts/local.sh                |   55 +++-
 tests/eventscripts/stubs/ctdb                      |    2 +-
 tests/eventscripts/stubs/ip                        |    2 -
 tests/onnode/README                                |   24 +-
 tests/onnode/scripts/local.sh                      |    9 +-
 tests/run_cluster_tests.sh                         |   15 +-
 tests/run_tests.sh                                 |   14 +-
 tests/scripts/common.sh                            |   32 ++
 tests/scripts/ctdb_test_env                        |   45 ---
 .../{ctdb_test_functions.bash => integration.bash} |  315 ++++++--------------
 tests/scripts/run_tests                            |   86 ++++--
 tests/scripts/test_wrap                            |   11 +-
 tests/simple/00_ctdb_init.sh                       |    2 +-
 tests/simple/00_ctdb_onnode.sh                     |    6 +-
 tests/simple/01_ctdb_version.sh                    |    2 +-
 tests/simple/02_ctdb_listvars.sh                   |    2 +-
 tests/simple/03_ctdb_getvar.sh                     |    2 +-
 tests/simple/04_ctdb_setvar.sh                     |    2 +-
 tests/simple/05_ctdb_listnodes.sh                  |    2 +-
 tests/simple/06_ctdb_getpid.sh                     |    2 +-
 tests/simple/07_ctdb_process_exists.sh             |    2 +-
 tests/simple/08_ctdb_isnotrecmaster.sh             |    2 +-
 tests/simple/09_ctdb_ping.sh                       |    2 +-
 tests/simple/11_ctdb_ip.sh                         |    2 +-
 tests/simple/12_ctdb_getdebug.sh                   |    2 +-
 tests/simple/13_ctdb_setdebug.sh                   |    2 +-
 tests/simple/14_ctdb_statistics.sh                 |    2 +-
 tests/simple/15_ctdb_statisticsreset.sh            |    2 +-
 tests/simple/16_ctdb_config_add_ip.sh              |    2 +-
 tests/simple/17_ctdb_config_delete_ip.sh           |    2 +-
 tests/simple/23_ctdb_moveip.sh                     |    2 +-
 tests/simple/24_ctdb_getdbmap.sh                   |    2 +-
 tests/simple/25_dumpmemory.sh                      |    2 +-
 ..._ctdb_config_check_error_on_unreachable_ctdb.sh |    2 +-
 tests/simple/31_ctdb_disable.sh                    |    2 +-
 tests/simple/32_ctdb_enable.sh                     |    2 +-
 tests/simple/41_ctdb_stop.sh                       |    2 +-
 tests/simple/42_ctdb_continue.sh                   |    2 +-
 tests/simple/43_stop_recmaster_yield.sh            |    2 +-
 tests/simple/51_ctdb_bench.sh                      |    2 +-
 tests/simple/52_ctdb_fetch.sh                      |    2 +-
 tests/simple/53_ctdb_transaction.sh                |    2 +-
 tests/simple/54_ctdb_transaction_recovery.sh       |    2 +-
 tests/simple/70_recoverpdbbyseqnum.sh              |    2 +-
 tests/simple/71_ctdb_wipedb.sh                     |    2 +-
 tests/simple/72_update_record_persistent.sh        |   32 +-
 tests/simple/73_tunable_NoIPTakeover.sh            |    2 +-
 tests/simple/75_readonly_records_basic.sh          |    2 +-
 tests/simple/99_daemons_shutdown.sh                |   23 ++
 tests/simple/README                                |    2 +
 tests/takeover/README                              |    5 +
 tests/takeover/scripts/local.sh                    |    2 +-
 tests/tool/README                                  |   19 ++
 tests/tool/scripts/local.sh                        |    6 +-
 74 files changed, 714 insertions(+), 502 deletions(-)
 create mode 100755 tests/INSTALL
 create mode 100644 tests/complex/README
 create mode 100644 tests/complex/scripts/local.bash
 mode change 120000 => 100644 tests/eventscripts/etc/sysconfig/ctdb
 delete mode 100755 tests/scripts/ctdb_test_env
 rename tests/scripts/{ctdb_test_functions.bash => integration.bash} (74%)
 create mode 100755 tests/simple/99_daemons_shutdown.sh
 create mode 100644 tests/simple/README
 create mode 100644 tests/takeover/README
 create mode 100644 tests/tool/README


Changeset truncated at 500 lines:

diff --git a/Makefile.in b/Makefile.in
index 7b7f356..843a948 100755
--- a/Makefile.in
+++ b/Makefile.in
@@ -364,6 +364,10 @@ install_pmda:
 	$(INSTALLCMD) -m 644 pmda/pmns pmda/domain.h pmda/help pmda/README $(PMDA_DEST_DIR)
 	$(INSTALLCMD) -m 755 bin/pmdactdb $(PMDA_DEST_DIR)
 
+# Should use $(datarootdir) but older autoconfs don't do this.  :-(
+install_tests: all
+	tests/INSTALL --destdir=$(DESTDIR) --datarootdir=$(prefix)/share --libdir=$(libdir) --bindir=$(bindir) --etcdir=$(etcdir)
+
 test: all
 	tests/run_tests.sh
 
diff --git a/config/events.d/13.per_ip_routing b/config/events.d/13.per_ip_routing
index f51d5ed..07687c0 100755
--- a/config/events.d/13.per_ip_routing
+++ b/config/events.d/13.per_ip_routing
@@ -136,7 +136,7 @@ clean_up_table_ids ()
     # Even if this didn't exist on the system, adding a route will
     # have created it.  What if we startup and immediately shutdown?
     if [ ! -f "$_f" ] ; then
-	mkdir -p $(basename "$_f")
+	mkdir -p $(dirname "$_f")
 	touch "$_f"
     fi
 
@@ -178,7 +178,7 @@ get_config_for_ip ()
 	    if [ "$_ip" = "$_i" ] ; then
 		echo -n "$_ip "; ipv4_host_addr_to_net "$_ip" "$_maskbits"
 	    fi
-	done <"${CTDB_PUBLIC_ADDRESSES:-${CTDB_BASE:-/dev/null}${CTDB:+/public_addresses}}"
+	done <"${CTDB_PUBLIC_ADDRESSES:-${CTDB_BASE:-/dev/null}${CTDB_BASE:+/public_addresses}}"
     else
 	[ -f "$CTDB_PER_IP_ROUTING_CONF" ] || return 1
 
diff --git a/tests/INSTALL b/tests/INSTALL
new file mode 100755
index 0000000..6f43650
--- /dev/null
+++ b/tests/INSTALL
@@ -0,0 +1,91 @@
+#!/bin/sh
+
+# Script to install the CTDB testsuite on a machine.
+
+usage ()
+{
+    if [ -n "$1" ] ; then
+	echo "$1"
+	echo
+    fi
+
+    cat <<EOF
+  $0 --destdir=<DIR1> \\
+     --datarootdir=<DIR2>  \\
+     --libdir=<DIR3> \\
+     --bindir=<DIR4> \\
+     --etcdir=<DIR5>
+EOF
+    exit 1
+}
+
+parse_options ()
+{
+    temp=$(getopt -n "$prog" -o "h" -l help,destdir:,datarootdir:,libdir:,bindir:,etcdir: -- "$@")
+
+    [ $? != 0 ] && usage
+
+    eval set -- "$temp"
+
+    destdir=""
+    datarootdir=""
+    libdir=""
+    bindir=""
+    etcdir=""
+
+    while true ; do
+        case "$1" in
+            --destdir) destdir="$2" ; shift 2 ;;
+            --datarootdir) datarootdir="$2" ; shift 2 ;;
+            --libdir) libdir="$2" ; shift 2 ;;
+            --bindir) bindir="$2" ; shift 2 ;;
+            --etcdir) etcdir="$2" ; shift 2 ;;
+            --) shift ; break ;;
+            -h|--help|*) usage ;; # Shouldn't happen, so this is reasonable.
+        esac
+    done
+
+    [ $# -gt 0 ] && usage
+
+    [ -n "$destdir" ]     || usage "No option --destdir specified"
+    [ -n "$datarootdir" ] || usage "No option --datarootdir specified"
+    [ -n "$libdir" ]      || usage "No option --libdir specified"
+    [ -n "$bindir" ]      || usage "No option --bindir specified"
+    [ -n "$etcdir" ]      || usage "No option --etcdir specified"
+}
+
+parse_options "$@"
+
+# Make things neater!
+if [ "$destdir" = "/" ] ; then
+    destdir=""
+fi
+
+data_subdirs="complex events.d eventscripts onnode scripts simple takeover tool"
+
+ctdb_datadir="${destdir}${datarootdir}/ctdb-tests"
+echo "Installing test data files into ${ctdb_datadir}..."
+for d in $data_subdirs ; do
+    mkdir -p "${ctdb_datadir}/${d}"
+    cp -pr "tests/${d}" "${ctdb_datadir}"
+done
+# Some of the unit tests have relative symlinks back to in-tree bits
+# and pieces.  These links will be broken!
+for i in "events.d" "functions" ; do
+    ln -sf "${etcdir}/ctdb/${i}" "${ctdb_datadir}/eventscripts/etc-ctdb/${i}"
+done
+
+ctdb_libdir="${destdir}${libdir}/ctdb-tests"
+mkdir -p  "${destdir}${libdir}"
+echo "Installing test binary files into ${ctdb_libdir}..."
+cp -pr "tests/bin/" "${ctdb_libdir}"
+
+ctdb_bindir="${destdir}${bindir}"
+echo "Installing wrapper scripts into ${ctdb_bindir}..."
+mkdir -p "${ctdb_bindir}"
+for i in tests/run_tests.sh tests/run_cluster_tests.sh ; do
+    b=$(basename "$i" ".sh")
+    out="${ctdb_bindir}/ctdb_${b}"
+    sed -e "s@^test_dir=.*@test_dir=${datarootdir}/ctdb-tests\nexport TEST_BIN_DIR=\"${libdir}/ctdb-tests\"@" "$i" >"${out}"
+    chmod 755 "$out"
+done
diff --git a/tests/README b/tests/README
index 5b6b714..1c9983b 100644
--- a/tests/README
+++ b/tests/README
@@ -1,106 +1,104 @@
 Introduction
 ------------
 
-The run_tests script can be run as follows:
+For a developer, the simplest way of running most tests on a local
+machine from within the git repository is:
 
-  scripts/run_tests simple/*.sh
+  make test
 
-It can also be run from other places (e.g. the top level ctdb source
-directory), as it works out where the tree is.
+This runs all unit tests (onnode, takeover, tool, eventscripts) and
+the tests against local daemons (simple) using the script
+tests/run_tests.sh.
 
-The pseudo-test simple/00_ctdb_init.sh causes ctdb to be (re)started
-on all nodes to attempt to force the cluster into a healthy state.  By
-default (i.e. if CTDB_TEST_REAL_CLUSTER is unset - see below) this
-causes some local daemons to be started on the local machine.  Tests
-can also be run against a real or virtual cluster.  All tests
-communicate with cluster nodes using onnode - when using local daemons
-this is accomplished via some test hooks in onnode and the ctdb
-client.
+When running tests against a real or virtual cluster the script
+tests/run_cluster_tests.sh can be used.  This runs all integration
+tests (simple, complex).
 
-Command-line options
---------------------
+Both of these scripts can also take a list of tests to run.  You can
+also pass options, which are then passed to run_tests.  However, if
+you just try to pass options to run_tests then you lose the default
+list of tests that are run.  You can't have everything...
 
-The most useful option is "-s", which causes a summary of test results
-to be printed at the end of testing.
+scripts/run_tests
+-----------------
 
-Environment variables
----------------------
+The above scripts invoke tests/scripts/run_tests.  This script has a
+lot of command-line switches.  Some of the more useful options
+include:
 
-run_tests supports several environment variables, mostly implemented
-in scripts/ctdb_test_env.  These are:
+  -s  Print a summary of tests results after running all tests
 
-* CTDB_TEST_REAL_CLUSTER
+  -l  Use local daemons for integration tests
 
-  If set, testing will occur on a real or virtual cluster.
+      This allows the tests in "simple" to be run against local
+      daemons.
 
-  Assumptions:
+      All integration tests communicate with cluster nodes using
+      onnode or the ctdb tool, which both have some test hooks to
+      support local daemons.
 
-  - The ctdb client command can be found via $PATH on the nodes.
+      By default 3 daemons are used.  If you want to use a different
+      number of daemons then do not use this option but set
+      TEST_LOCAL_DAEMONS to the desired number of daemons instead.
+      The -l option just sets TEST_LOCAL_DAEMONS to 3...  :-)
 
-  - Password-less ssh access to the cluster nodes is permitted from
-    the test host.
+  -e  Exit on the first test failure
 
-  - $CTDB_NODES_FILE is set to the location of a file similar to
-    /etc/ctdb/nodes.  The file can be obtained by scping it from one
-    of the cluster nodes.
+  -C  Clean up - kill daemons and remove $TEST_VAR_DIR when done
 
-  - See CTDB_TEST_REMOTE_DIR.
+      Tests uses a temporary/var directory for test state.  By default,
+      this directory is not removed when tests are complete, so you
+      can do forensics or, for integration tests, re-run tests that
+      have failed against the same directory (with the same local
+      daemons setup).  So this option cleans things up.
 
-  If not set, testing will proceed against local daemons.
+      Also kills local daemons associated with directory.
 
-* CTDB_TEST_REMOTE_DIR
+  -V  Use <dir> as $TEST_VAR_DIR
 
-  This may be required when running against a real or virtual cluster
-  (as opposed to local daemons).
+      Use the specified temporary temporary/var directory.
 
-  If set, this points to a directory containing the contents of the
-  tests/scripts/ directory, as well as all of the test binaries.  This
-  can be accomplished in a couple of ways:
+  -H  No headers - for running single test with other wrapper
 
-  * By copying the relevant scripts/binaries to some directory.
+      This allows tests to be embedded in some other test framework
+      and executed one-by-one with all the required
+      environment/infrastructure.
 
-  * Building an RPM containing all of the test code that is required
-    on the cluster nodes and installing it on each node.  Hopefully
-    this will be supported in a future version of the CTDB packaging
-    process.
+      This replaces the old ctdb_test_env script.
 
-  If not set, the test system assumes that the CTDB tree is available
-  in the same location on the cluster nodes as on the test host.  This
-  could be accomplished by copying or by sharing with NFS (or
-  similar).
+How do the tests find remote test programs?
+-------------------------------------------
 
-* VALGRIND
+If the all of the cluster nodes have the CTDB git tree in the same
+location as on the test client then no special action is necessary.
+The simplest way of doing this is to share the tree to cluster nodes
+and test clients via NFS.
 
-  This can be used to cause all invocations of the ctdb client (and,
-  with local daemons, the ctdbd daemons themselves) to occur under
-  valgrind.
+If cluster nodes do not have the CTDB git tree then
+CTDB_TEST_REMOTE_DIR can be set to a directory that, on each cluster
+node, contains the contents of tests/scripts/ and tests/bin/.
 
-  The easiest way of doing this is something like:
+In the future this will hopefully (also) be supported via a ctdb-test
+package.
 
-    VALGRIND="valgrind -q" scripts/run_tests ...
+Running the ctdb tool under valgrind
+------------------------------------
 
-  NOTE: Some libc calls seem to do weird things and perhaps cause
-  spurious output from ctdbd at start time.  Please read valgrind
-  output carefully before reporting bugs.  :-)
+The easiest way of doing this is something like:
 
-* CTDB
+  VALGRIND="valgrind -q" scripts/run_tests ...
 
-  How to invoke the ctdb client.  If not already set and if $VALGRIND
-  is set, this is set to "$VALGRIND ctdb".  If this is not already set
-  but $VALGRIND is not set, this is simply set to "ctdb"
+This can be used to cause all invocations of the ctdb client (and,
+with local daemons, the ctdbd daemons themselves) to occur under
+valgrind.
 
-Look, no run_test!
-------------------
+NOTE: Some libc calls seem to do weird things and perhaps cause
+spurious output from ctdbd at start time.  Please read valgrind output
+carefully before reporting bugs.  :-)
 
-If you want to integrate individual tests into some other test
-environment you can use scripts/ctdb_test_env to wrap individual
-tests.  They will return 0 on success, non-zero otherwise, and will
-print the output omitting the test header/footer that surrounds test
-output when tests are run using run_tests.  So, you can do something
-like:
+How is the ctdb tool invoked?
+-----------------------------
 
-  for i in simple/*.sh ; do
-      my_test_framework_wrapper scripts/ctdb_test_env $i
-  done
-
-to have your own framework process the test results and output.
+$CTDB determines how to invoke the ctdb client.  If not already set
+and if $VALGRIND is set, this is set to "$VALGRIND ctdb".  If this is
+not already set but $VALGRIND is not set, this is simply set to "ctdb"
diff --git a/tests/complex/01_ctdb_nfs_skip_share_check.sh b/tests/complex/01_ctdb_nfs_skip_share_check.sh
index 969b445..a7ad938 100755
--- a/tests/complex/01_ctdb_nfs_skip_share_check.sh
+++ b/tests/complex/01_ctdb_nfs_skip_share_check.sh
@@ -54,7 +54,7 @@ Expected results:
 EOF
 }
 
-. ctdb_test_functions.bash
+. "${TEST_SCRIPTS_DIR}/integration.bash"
 
 set -e
 
diff --git a/tests/complex/02_ctdb_samba_skip_share_check.sh b/tests/complex/02_ctdb_samba_skip_share_check.sh
index c7eadc6..9097a78 100755
--- a/tests/complex/02_ctdb_samba_skip_share_check.sh
+++ b/tests/complex/02_ctdb_samba_skip_share_check.sh
@@ -56,7 +56,7 @@ Expected results:
 EOF
 }
 
-. ctdb_test_functions.bash
+. "${TEST_SCRIPTS_DIR}/integration.bash"
 
 set -e
 
diff --git a/tests/complex/11_ctdb_delip_removes_ip.sh b/tests/complex/11_ctdb_delip_removes_ip.sh
index f60b630..043c345 100755
--- a/tests/complex/11_ctdb_delip_removes_ip.sh
+++ b/tests/complex/11_ctdb_delip_removes_ip.sh
@@ -38,7 +38,7 @@ Expected results:
 EOF
 }
 
-. ctdb_test_functions.bash
+. "${TEST_SCRIPTS_DIR}/integration.bash"
 
 set -e
 
diff --git a/tests/complex/31_nfs_tickle.sh b/tests/complex/31_nfs_tickle.sh
index dcbd4d7..ce4ae81 100755
--- a/tests/complex/31_nfs_tickle.sh
+++ b/tests/complex/31_nfs_tickle.sh
@@ -39,7 +39,7 @@ Expected results:
 EOF
 }
 
-. ctdb_test_functions.bash
+. "${TEST_SCRIPTS_DIR}/integration.bash"
 
 set -e
 
diff --git a/tests/complex/32_cifs_tickle.sh b/tests/complex/32_cifs_tickle.sh
index 3a77381..93634e7 100755
--- a/tests/complex/32_cifs_tickle.sh
+++ b/tests/complex/32_cifs_tickle.sh
@@ -38,7 +38,7 @@ Expected results:
 EOF
 }
 
-. ctdb_test_functions.bash
+. "${TEST_SCRIPTS_DIR}/integration.bash"
 
 set -e
 
diff --git a/tests/complex/33_gratuitous_arp.sh b/tests/complex/33_gratuitous_arp.sh
index 8a3de03..721b0f2 100755
--- a/tests/complex/33_gratuitous_arp.sh
+++ b/tests/complex/33_gratuitous_arp.sh
@@ -38,7 +38,7 @@ Expected results:
 EOF
 }
 
-. ctdb_test_functions.bash
+. "${TEST_SCRIPTS_DIR}/integration.bash"
 
 set -e
 
diff --git a/tests/complex/41_failover_ping_discrete.sh b/tests/complex/41_failover_ping_discrete.sh
index 73bc84e..88b2013 100755
--- a/tests/complex/41_failover_ping_discrete.sh
+++ b/tests/complex/41_failover_ping_discrete.sh
@@ -32,7 +32,7 @@ Expected results:
 EOF
 }
 
-. ctdb_test_functions.bash
+. "${TEST_SCRIPTS_DIR}/integration.bash"
 
 set -e
 
diff --git a/tests/complex/42_failover_ssh_hostname.sh b/tests/complex/42_failover_ssh_hostname.sh
index f1a01f7..defe15a 100755
--- a/tests/complex/42_failover_ssh_hostname.sh
+++ b/tests/complex/42_failover_ssh_hostname.sh
@@ -32,7 +32,7 @@ Expected results:
 EOF
 }
 
-. ctdb_test_functions.bash
+. "${TEST_SCRIPTS_DIR}/integration.bash"
 
 set -e
 
diff --git a/tests/complex/43_failover_nfs_basic.sh b/tests/complex/43_failover_nfs_basic.sh
index 883a452..71a8229 100755
--- a/tests/complex/43_failover_nfs_basic.sh
+++ b/tests/complex/43_failover_nfs_basic.sh
@@ -36,7 +36,7 @@ Expected results:
 EOF
 }
 
-. ctdb_test_functions.bash
+. "${TEST_SCRIPTS_DIR}/integration.bash"
 
 set -e
 
diff --git a/tests/complex/44_failover_nfs_oneway.sh b/tests/complex/44_failover_nfs_oneway.sh
index 8fa12b9..7da8d01 100755
--- a/tests/complex/44_failover_nfs_oneway.sh
+++ b/tests/complex/44_failover_nfs_oneway.sh
@@ -38,7 +38,7 @@ Expected results:
 EOF
 }
 
-. ctdb_test_functions.bash
+. "${TEST_SCRIPTS_DIR}/integration.bash"
 
 set -e
 
diff --git a/tests/complex/README b/tests/complex/README
new file mode 100644
index 0000000..72de396
--- /dev/null
+++ b/tests/complex/README
@@ -0,0 +1,2 @@
+Complex integration tests.  These need a real or virtual cluster.
+That is, they can not be run against local daemons.
diff --git a/tests/complex/scripts/local.bash b/tests/complex/scripts/local.bash
new file mode 100644
index 0000000..e3cd431
--- /dev/null
+++ b/tests/complex/scripts/local.bash
@@ -0,0 +1,139 @@
+# Hey Emacs, this is a -*- shell-script -*- !!!  :-)
+
+get_src_socket ()
+{
+    local proto="$1"
+    local dst_socket="$2"
+    local pid="$3"
+    local prog="$4"
+
+    local pat="^${proto}[[:space:]]+[[:digit:]]+[[:space:]]+[[:digit:]]+[[:space:]]+[^[:space:]]+[[:space:]]+${dst_socket//./\\.}[[:space:]]+ESTABLISHED[[:space:]]+${pid}/${prog}[[:space:]]*\$"
+    out=$(netstat -tanp |
+	egrep "$pat" |
+	awk '{ print $4 }')
+
+    [ -n "$out" ]
+}
+
+wait_until_get_src_socket ()
+{
+    local proto="$1"
+    local dst_socket="$2"
+    local pid="$3"
+    local prog="$4"
+
+    echo "Waiting for ${prog} to establish connection to ${dst_socket}..."
+
+    wait_until 5 get_src_socket "$@"
+}
+
+#######################################
+
+# filename will be in $tcpdump_filename, pid in $tcpdump_pid
+tcpdump_start ()
+{
+    tcpdump_filter="$1" # global
+
+    echo "Running tcpdump..."
+    tcpdump_filename=$(mktemp)
+    ctdb_test_exit_hook_add "rm -f $tcpdump_filename"
+
+    # The only way of being sure that tcpdump is listening is to send


-- 
CTDB repository


More information about the samba-cvs mailing list