def teardown(config):
    pids = Cgroup.get_pids_in_cgroup(config, CGNAME, CONTROLLER)
    if pids:
        for p in pids.splitlines():
            if config.args.container:
                config.container.run(['kill', '-9', p])
            else:
                Run.run(['sudo', 'kill', '-9', p])

    Cgroup.delete(config, CONTROLLER, CGNAME)
def test(config):
    config.process.create_process_in_cgroup(config,
                                            CONTROLLER,
                                            CGNAME,
                                            cgclassify=False)

    pids = Cgroup.get_pids_in_cgroup(config, CGNAME, CONTROLLER)
    if pids is None:
        result = consts.TEST_FAILED
        cause = 'No processes were found in cgroup {}'.format(CGNAME)
        return result, cause

    # run cgexec -h
    ret = Cgroup.cgexec(config,
                        controller=CONTROLLER,
                        cgname=CGNAME,
                        cmdline=None,
                        cghelp=True)
    if 'Run the task in given control group(s)' not in ret:
        result = consts.TEST_FAILED
        cause = 'Failed to print cgexec help text: {}'.format(ret)
        return result, cause

    return consts.TEST_PASSED, None