*** Keywords ***
Export Global Variables
${TESTDIR} = Get Test Directory
- Set Global Variable ${RSPAMADM} ${TESTDIR}/../../src/rspamadm/rspamadm
- Set Global Variable ${RSPAMC} ${TESTDIR}/../../src/client/rspamc
- Set Global Variable ${RSPAMD} ${TESTDIR}/../../src/rspamd
+ ${RSPAMADM} = Get Rspamadm
+ ${RSPAMC} = Get Rspamc
+ ${RSPAMD} = Get Rspamd
+ Set Global Variable ${RSPAMADM}
+ Set Global Variable ${RSPAMC}
+ Set Global Variable ${RSPAMD}
Set Global Variable ${TESTDIR}
return children
def get_test_directory():
- return os.path.abspath(os.path.dirname(os.path.realpath(__file__)) + "../..")
+ return os.path.abspath(os.path.dirname(os.path.realpath(__file__)) + "../../")
+
+def get_top_dir():
+ if os.environ.get('RSPAMD_TOPDIR'):
+ return os.environ['RSPAMD_TOPDIR']
+
+ return get_test_directory() + "../../"
+
+def get_rspamd():
+ if os.environ.get('RSPAMD'):
+ return os.environ['RSPAMD']
+ dname = get_top_dir()
+ return dname + "src/rspamd"
+def get_rspamc():
+ if os.environ.get('RSPAMC'):
+ return os.environ['RSPAMC']
+ dname = get_top_dir()
+ return dname + "src/client/rspamc"
+def get_rspamadm():
+ if os.environ.get('RSPAMADM'):
+ return environ['RSPAMADM']
+ dname = get_top_dir()
+ return dname + "src/rspamadm/rspamadm"
def make_temporary_directory():
return tempfile.mkdtemp()
os.kill(pid, signal.SIGUSR1)
def set_directory_ownership(path, username, groupname):
- uid=pwd.getpwnam(username).pw_uid
- gid=grp.getgrnam(groupname).gr_gid
- os.chown(path, uid, gid)
+ if os.getuid() == 0:
+ uid=pwd.getpwnam(username).pw_uid
+ gid=grp.getgrnam(groupname).gr_gid
+ os.chown(path, uid, gid)
def spamc(addr, port, filename):
goo = open(filename, 'rb').read()