How to use set_property_h method in autotest

Best Python code snippet using autotest_python

cgroup.py

Source:cgroup.py Github

copy

Full Screen

...152 ################################################153 logging.debug("test_memory: Memfill mem only limit")154 ps = item.test("memfill %d %s" % (mem, outf.name))155 item.set_cgroup(ps.pid, pwd)156 item.set_property_h("memory.limit_in_bytes", ("%dM" % (mem/2)), pwd)157 ps.stdin.write('\n')158 i = 0159 while ps.poll() == None:160 if i > 120:161 break162 i += 1163 time.sleep(1)164 if i > 120:165 ps.terminate()166 raise error.TestFail("Memory filling failed (mem)")167 outf.seek(0)168 outf.flush()169 out = outf.readlines()170 if (len(out) < 2):171 raise error.TestFail("Process failed (mem); output:\n%s"172 "\nReturn: %d" % (out, ps.poll()))173 if memsw:174 if not out[-1].startswith("PASS"):175 logging.error("test_memory: cgroup_client.py returned %d; "176 "output:\n%s", ps.poll(), out)177 raise error.TestFail("Unsuccessful memory filling (mem)")178 else:179 if out[-1].startswith("PASS"):180 raise error.TestFail("Unexpected memory filling (mem)")181 else:182 filled = int(out[-2].split()[1][:-1])183 if mem/2 > 1.5 * filled:184 logging.error("test_memory: Limit = %dM, Filled = %dM (+ "185 "python overhead upto 1/3 (mem))", mem/2,186 filled)187 else:188 logging.debug("test_memory: Limit = %dM, Filled = %dM (+ "189 "python overhead upto 1/3 (mem))", mem/2,190 filled)191 logging.debug("test_memory: Memfill mem only cgroup passed")192 ################################################193 # Fill the memory with 1/2 memory+swap limit194 # Should fail195 # (memory.limit_in_bytes have to be set prior to this test)196 ################################################197 if memsw:198 logging.debug("test_memory: Memfill mem + swap limit")199 ps = item.test("memfill %d %s" % (mem, outf.name))200 item.set_cgroup(ps.pid, pwd)201 item.set_property_h("memory.memsw.limit_in_bytes", "%dM"%(mem/2),202 pwd)203 ps.stdin.write('\n')204 i = 0205 while ps.poll() == None:206 if i > 120:207 break208 i += 1209 time.sleep(1)210 if i > 120:211 ps.terminate()212 raise error.TestFail("Memory filling failed (mem)")213 outf.seek(0)214 outf.flush()215 out = outf.readlines()...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run autotest automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful