mirror of
https://gitlab.com/buildroot.org/buildroot.git
synced 2026-09-19 16:40:46 -09:00
support/testing: use .assertRunOk() when possible
The BRTest() class implements an assertRunOk() method that does the very common work of running a command inside the emulator, and checking that it is successful. This commit changes all locations where this .assertRunOk() method can be used, instead of open-coding the same logic. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com> Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
This commit is contained in:
committed by
Yann E. MORIN
parent
f579afc393
commit
afc1ed4d51
@@ -22,19 +22,18 @@ class TestS6Rc(infra.basetest.BRTest):
|
||||
self.assertEqual(exit_code, 100)
|
||||
|
||||
# Set up two service directories with a dependency
|
||||
self.emulator.run("mkdir -p source/testsv1")
|
||||
self.emulator.run("mkdir -p source/testsv2")
|
||||
self.emulator.run("echo oneshot > source/testsv1/type")
|
||||
self.emulator.run("echo oneshot > source/testsv2/type")
|
||||
self.emulator.run("echo 'echo foo' > source/testsv1/up")
|
||||
self.emulator.run("echo 'echo bar' > source/testsv2/up")
|
||||
self.emulator.run("echo testsv1 > source/testsv2/dependencies")
|
||||
self.emulator.run("chmod +x source/testsv1/up")
|
||||
self.emulator.run("chmod +x source/testsv2/up")
|
||||
self.assertRunOk("mkdir -p source/testsv1")
|
||||
self.assertRunOk("mkdir -p source/testsv2")
|
||||
self.assertRunOk("echo oneshot > source/testsv1/type")
|
||||
self.assertRunOk("echo oneshot > source/testsv2/type")
|
||||
self.assertRunOk("echo 'echo foo' > source/testsv1/up")
|
||||
self.assertRunOk("echo 'echo bar' > source/testsv2/up")
|
||||
self.assertRunOk("echo testsv1 > source/testsv2/dependencies")
|
||||
self.assertRunOk("chmod +x source/testsv1/up")
|
||||
self.assertRunOk("chmod +x source/testsv2/up")
|
||||
|
||||
# Compile the service database
|
||||
_, exit_code = self.emulator.run("s6-rc-compile compiled source")
|
||||
self.assertEqual(exit_code, 0)
|
||||
self.assertRunOk("s6-rc-compile compiled source")
|
||||
|
||||
# Inspect dependencies
|
||||
cmd = "s6-rc-db -c compiled -d dependencies testsv1"
|
||||
|
||||
Reference in New Issue
Block a user