# # patch "ChangeLog" # from [eb1ef899e25adcf514b177548b15d36aebf0c78f] # to [c2ec20ee83e66b957fc33eb389f2a27d1796647e] # # patch "tests/t_netsync_permissions.at" # from [2e18d7f1e43cc50034a417b6ea6f18c79c5467c3] # to [e80f268b30c413c97c5316d6bf07f3d70fe7fab5] # # patch "tests/t_netsync_read_permissions.at" # from [123e1ee25ec04d06cf8b221227e1456e38af732e] # to [76c9bbf928f94253172ff4d5aac6cdb2fd35a81c] # # patch "testsuite.at" # from [f52cdb677ffd9851c93986c68c422a6919a131be] # to [9e29aa61b0bea500aee16647582329806f19d1e9] # ======================================================================== --- ChangeLog eb1ef899e25adcf514b177548b15d36aebf0c78f +++ ChangeLog c2ec20ee83e66b957fc33eb389f2a27d1796647e @@ -1,5 +1,13 @@ 2005-11-10 Timothy Brownawell + * testsuite.at: Several MINHOOKS_* macros that use the standard hooks + and only load predefined hooks about passphrase and rng. + * tests/t_netsync_permissions, tests/t_netsync_read_permissions: use + the standard permission hooks and define {read,write}-permissions files. + Check both the permissions mechanism and the standard hooks at once. + +2005-11-10 Timothy Brownawell + * monotone.texi: update example project with latest read-permissions format. Mention comment lines in the description in the hooks section ======================================================================== --- tests/t_netsync_permissions.at 2e18d7f1e43cc50034a417b6ea6f18c79c5467c3 +++ tests/t_netsync_permissions.at e80f268b30c413c97c5316d6bf07f3d70fe7fab5 @@ -12,16 +12,14 @@ NETSYNC_SETUP # test with open security settings - -AT_DATA(open.lua, [ -function get_netsync_read_permitted(pattern, identity) - return true -end - -function get_netsync_write_permitted(identity) - return true -end +AT_CHECK(mkdir open) +AT_DATA(open/read-permissions, [ +pattern "*" +allow "*" ]) +AT_DATA(open/write-permissions, [ +* +]) AT_CHECK(cp test.db clean.db) AT_CHECK(cp -r keys/ clean_keys) @@ -31,7 +29,7 @@ AT_CHECK(MONOTONE --branch=testbranch commit --message testfile, [], [ignore], [ignore]) BASE=`BASE_REVISION` -NETSYNC_SERVE_START(testbranch --rcfile open.lua) +MINHOOKS_NETSYNC_SERVE_START(testbranch --confdir open) # anonymous pull @@ -101,18 +99,14 @@ # test with closed security settings - -AT_DATA(closed.lua, [ -function get_netsync_read_permitted(pattern, identity) - if (identity == "address@hidden") then return true end - return false -end - -function get_netsync_write_permitted(identity) - if (identity == "address@hidden") then return true end - return false -end +AT_CHECK(mkdir closed) +AT_DATA(closed/read-permissions, [ +pattern "*" +allow "address@hidden" ]) +AT_DATA(closed/write-permissions, [ address@hidden +]) AT_CHECK(cp clean.db test.db) AT_CHECK(rm -r keys && cp -r clean_keys/ keys) @@ -123,7 +117,7 @@ AT_CHECK(MONOTONE --branch=testbranch commit --message testfile, [], [ignore], [ignore]) BASE=`BASE_REVISION` -NETSYNC_SERVE_START(testbranch --rcfile closed.lua) +MINHOOKS_NETSYNC_SERVE_START(testbranch --confdir closed) # anonymous pull fails ======================================================================== --- tests/t_netsync_read_permissions.at 123e1ee25ec04d06cf8b221227e1456e38af732e +++ tests/t_netsync_read_permissions.at 76c9bbf928f94253172ff4d5aac6cdb2fd35a81c @@ -26,15 +26,15 @@ # pulling more than that should error out # pulling exactly that should give revs B1, B2, B3; and only give # branch certs on B1, B3. - -AT_DATA(limited_permission.at, [function get_netsync_read_permitted(branch, key) - if branch == "branch1" then return true end - if branch == "branch3" then return true end - return false -end +AT_CHECK(mkdir perm) +AT_DATA(perm/read-permissions, [ +pattern "branch1" +allow "*" +pattern "branch3" +allow "*" ]) -NETSYNC_SERVE_START(--rcfile=limited_permission.at 'branch*') +MINHOOKS_NETSYNC_SERVE_START(--confdir=perm 'branch*') NETSYNC_CLIENT_RUN(pull, 'branch*') AT_CHECK(MONOTONE2 automate get_revision $B1, [1], [ignore], [ignore]) ======================================================================== --- testsuite.at f52cdb677ffd9851c93986c68c422a6919a131be +++ testsuite.at 9e29aa61b0bea500aee16647582329806f19d1e9 @@ -17,6 +17,7 @@ # Set PREEXECUTE in your environment to run monotone under, e.g., valgrind. m4_define([MONOTONE], [$PREEXECUTE $_MT_EXEC --rcfile=$_ROOT_DIR/test_hooks.lua --nostd --norc --db=$_ROOT_DIR/test.db --keydir=$_ROOT_DIR/keys address@hidden --root=$_ROOT_DIR]) m4_define([RAW_MONOTONE], [$PREEXECUTE monotone --norc]) +m4_define([MINHOOKS_MONOTONE], [$PREEXECUTE $_MT_EXEC --db=$_ROOT_DIR/test.db --keydir=$_ROOT_DIR/keys --rcfile=$_ROOT_DIR/min_hooks.lua address@hidden --root=$_ROOT_DIR]) m4_define([SHA1], [monotone --norc identify $1]) m4_define([BASE_REVISION], [cat MT/revision]) m4_define([WORKING_REVISION], [monotone --norc automate get_revision | monotone --norc identify]) @@ -63,6 +64,18 @@ @<:@end@:>@ ]) +AT_DATA(min_hooks.lua, [ +function get_passphrase(keyid) + return keyid +end +function non_blocking_rng_ok() + return true +end +function persist_phrase_ok() + return true +end +]) + AT_DATA(test_hooks.lua, [ -- this is the "testing" set of lua hooks for monotone -- it's intended to support self-tests, not for use in @@ -397,6 +410,19 @@ MONOTONE --rcfile=netsync.lua --pid-file=monotone_at.pid --dump=MT/server_dump --bind=NETSYNC_ADDRESS serve m4_if($1, [], "{}*", $1) & sleep 4 ]) +# run as STDHOOKS_NETSYNC_SERVE_N_START(2|3, pattern) +# note that NETSYNC_SERVE_START is _not_ a special case of this macro. +m4_define([MINHOOKS_NETSYNC_SERVE_N_START], [ +NETSYNC_KILLHARD +MINHOOKS_MONOTONE --db=test$1.db --keydir=keys$1 --pid-file=monotone_at.pid --dump=MT/server_dump --bind=NETSYNC_ADDRESS serve m4_if($2, [], "{}*", $2) & +sleep 4 +]) +# run as MINHOOKS_NETSYNC_SERVE_START(pattern) +m4_define([MINHOOKS_NETSYNC_SERVE_START], [ +NETSYNC_KILLHARD +MINHOOKS_MONOTONE --pid-file=monotone_at.pid --dump=MT/server_dump --bind=NETSYNC_ADDRESS serve m4_if($1, [], "{}*", $1) & +sleep 4 +]) # run as NETSYNC_SERVE_STOP m4_define([NETSYNC_SERVE_STOP], [ NETSYNC_KILL