Some cgroups testing were failing because of some rogue tab characters in the middle of strings being compared. Let's sanitize values before comparison.
Also, let's do proper comparisons of boolean values and None. Signed-off-by: Lucas Meneghel Rodrigues <[email protected]> --- client/cgroup_utils.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/client/cgroup_utils.py b/client/cgroup_utils.py index 593f851..b6d3edb 100755 --- a/client/cgroup_utils.py +++ b/client/cgroup_utils.py @@ -215,15 +215,18 @@ class Cgroup(object): if isinstance(pwd, int): pwd = self.cgroups[pwd] try: - open(pwd+prop, 'w').write(value) + open(os.path.join(pwd, prop), 'w').write(value) except Exception, inst: raise error.TestError("cg.set_property(): %s" % inst) - if check != False: - if check == True: + + if check is not False: + if check is True: check = value - if checkprop == None: + if checkprop is None: checkprop = prop _values = self.get_property(checkprop, pwd) + # Sanitize non printable characters before check + check = " ".join(check.split()) if check not in _values: raise error.TestError("cg.set_property(): Setting failed: " "desired = %s, real values = %s" -- 1.8.0 _______________________________________________ Autotest-kernel mailing list [email protected] https://www.redhat.com/mailman/listinfo/autotest-kernel
