# # # add_dir "tests/attr_set_drop" # # add_dir "tests/clobbered_attrs" # # add_file "tests/attr_set_drop/__driver__.lua" # content [81b453444a735d9074b44b1581452535f914b3ca] # # add_file "tests/clobbered_attrs/__driver__.lua" # content [bfb5a45667663a0f57d8bc580619aeed33640862] # ============================================================ --- tests/attr_set_drop/__driver__.lua 81b453444a735d9074b44b1581452535f914b3ca +++ tests/attr_set_drop/__driver__.lua 81b453444a735d9074b44b1581452535f914b3ca @@ -0,0 +1,23 @@ +-- attr_drop mtn:execute does not clear execute bits + +skip_if(ostype=="Windows") + +mtn_setup() + +writefile("foo", "some data") +check(mtn("add", "foo"), 0, false, false) + +-- check that no execute bits are set +check({"test", "!", "-x","foo"}, 0, false, false) + +-- setting mtn:execute does set the file's execute bits +check(mtn("attr", "set", "foo", "mtn:execute", "true"), 0, false, false) +check({"test", "-x","foo"}, 0, false, false) + +-- dropping mtn:execute does NOT clear the file's execute bits +-- this is a minor bug/inconsistency since set does set the execute bits +-- it's caused by the fact that both attr_set and attr_drop call +-- updade_any_attrs which only sets currently existing attrs and doesn't clear +-- them +check(mtn("attr", "drop", "foo", "mtn:execute"), 0, false, false) +xfail({"test", "!", "-x","foo"}, 0, false, false) ============================================================ --- tests/clobbered_attrs/__driver__.lua bfb5a45667663a0f57d8bc580619aeed33640862 +++ tests/clobbered_attrs/__driver__.lua bfb5a45667663a0f57d8bc580619aeed33640862 @@ -0,0 +1,42 @@ +-- attrs re-set on unrelated files + +skip_if(ostype=="Windows") +skip_if(not existsonpath("chmod")) + +mtn_setup() + +writefile("foo", "some data") +writefile("bar", "other data") + +check(mtn("add", "foo", "bar"), 0, false, false) + +-- check that no execute bit is set +check({"test", "!", "-x","foo"}, 0, false, false) +check({"test", "!", "-x","bar"}, 0, false, false) + +-- setting mtn:execute does set the file's execute bits +check(mtn("attr", "set", "foo", "mtn:execute", "true"), 0, false, false) +check({"test", "-x","foo"}, 0, false, false) +check({"test", "!", "-x","bar"}, 0, false, false) + +-- manually clear the execute bits from foo +check({"chmod", "-x", "foo"}, 0, false, false) +check({"test", "!", "-x","foo"}, 0, false, false) +check({"test", "!", "-x","bar"}, 0, false, false) + +-- now tell monotone to set the execute bits on bar +-- this should not touch foo +check(mtn("attr", "set", "bar", "mtn:execute", "true"), 0, false, false) +xfail({"test", "!", "-x","foo"}, 0, false, false) +check({"test", "-x","bar"}, 0, false, false) + +-- manually clear the execute bits from foo and bar +check({"chmod", "-x", "foo", "bar"}, 0, false, false) +check({"test", "!", "-x","foo"}, 0, false, false) +check({"test", "!", "-x","bar"}, 0, false, false) + +-- revert changes to foo +-- this should not touch bar +check(mtn("revert", "foo"), 0, false, false) +check({"test", "!", "-x","foo"}, 0, false, false) +xfail({"test", "!", "-x","bar"}, 0, false, false)