Add some consistency check for content of check_process compared to manifest

This commit is contained in:
Alexandre Aubin 2020-11-03 19:03:01 +01:00
parent 43523543e0
commit 7d5b87ef84

View file

@ -474,6 +474,35 @@ class App(TestSuite):
if os.system("grep -q ' *Level [^5]=' %s" % check_process_file) == 0: if os.system("grep -q ' *Level [^5]=' %s" % check_process_file) == 0:
yield Warning("Setting Level x=y in check_process is obsolete / not relevant anymore") yield Warning("Setting Level x=y in check_process is obsolete / not relevant anymore")
@test()
def check_process_consistency(app):
check_process_file = app.path + "/check_process"
if not file_exists(check_process_file):
return
has_is_public_arg = any(a["name"] == "is_public" for a in app.manifest["arguments"].get("install", []))
if has_is_public_arg:
if os.system(r"grep -q '^\s*setup_public=1' %s" % check_process_file) != 0:
yield Warning("It looks like you forgot to enable setup_public test in check_process ?")
if os.system(r"grep -q '^\s*setup_private=1' %s" % check_process_file) != 0:
yield Warning("It looks like you forgot to enable setup_private test in check_process ?")
has_path_arg = any(a["name"] == "path" for a in app.manifest["arguments"].get("install", []))
if has_path_arg:
if os.system(r"grep -q '^\s*setup_sub_dir=1' %s" % check_process_file) != 0:
yield Warning("It looks like you forgot to enable setup_sub_dir test in check_process ?")
if app.manifest.get("multi_instance") in [True, 1, "True", "true"]:
if os.system(r"grep -q '^\s*multi_instance=1' %s" % check_process_file) != 0:
yield Warning("It looks like you forgot to enable multi_instance test in check_process ?")
if app.scripts["backup"].exists:
if os.system(r"grep -q '^\s*backup_restore=1' %s" % check_process_file) != 0:
yield Warning("It looks like you forgot to enable backup_restore test in check_process ?")
@test() @test()
def misc_legacy_phpini(app): def misc_legacy_phpini(app):