1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- #!/usr/bin/python
- import os, sys, mmap
- from regression import Regression
- loader = '../src/pal'
- # Running Bootstrap
- regression = Regression(loader, "Bootstrap")
- regression.add_check(name="Basic Bootstrapping",
- check=lambda res: "User Program Started" in res[0].log)
- regression.add_check(name="Control Block: Executable Name",
- check=lambda res: "Loaded Executable: file:Bootstrap" in res[0].log)
- regression.add_check(name="Control Block: Default Manifest",
- check=lambda res: "Loaded Manifest: file:manifest" in res[0].log)
- regression.add_check(name="One Argument Given",
- check=lambda res: "# of Arguments: 1" in res[0].log and \
- "argv[0] = file:Bootstrap" in res[0].log)
- regression.add_check(name="Five Arguments Given",
- args = ['a', 'b', 'c', 'd'],
- check=lambda res: "# of Arguments: 5" in res[0].log and \
- "argv[0] = file:Bootstrap" in res[0].log and \
- "argv[1] = a" in res[0].log and "argv[2] = b" in res[0].log and \
- "argv[3] = c" in res[0].log and "argv[4] = d" in res[0].log)
- regression.add_check(name="Control Block: Debug Stream (Inline)",
- check=lambda res: "Written to Debug Stream" in res[0].out)
- regression.add_check(name="Control Block: Page Size",
- check=lambda res: ("Page Size: %d" % (mmap.PAGESIZE)) in res[0].log)
- regression.add_check(name="Control Block: Allocation Alignment",
- check=lambda res: ("Allocation Alignment: %d" % (mmap.ALLOCATIONGRANULARITY)) in res[0].log)
- regression.add_check(name="Control Block: Executable Range",
- check=lambda res: "Executable Range OK" in res[0].log)
- regression.run_checks()
- # Running Bootstrap2
- regression = Regression(loader, "Bootstrap2")
- regression.add_check(name="Control Block: Manifest as Executable Name",
- check=lambda res: "Loaded Manifest: file:Bootstrap2.manifest" in res[0].log)
- regression.run_checks()
- # Running Bootstrap3
- regression = Regression(loader, "Bootstrap3")
- regression.add_check(name="Preload Libraries",
- check=lambda res: "Binary 1 Preloaded" in res[0].log and
- "Binary 2 Preloaded" in res[0].log)
- regression.add_check(name="Preload Libraries Linking",
- check=lambda res: "Preloaded Function 1 Called" in res[0].log and
- "Preloaded Function 2 Called" in res[0].log)
- regression.run_checks()
- # Running Bootstrap4
- regression = Regression(loader, "Bootstrap4.manifest")
- regression.add_check(name="Control Block: Manifest as Argument",
- check=lambda res: "Loaded Manifest: file:Bootstrap4.manifest" in res[0].log)
- regression.add_check(name="Control Block: Executable as in Manifest",
- check=lambda res: "Loaded Executable: file:Bootstrap" in res[0].log)
- regression.run_checks()
- # Running Bootstrap4.manifest
- regression = Regression(executable = "./Bootstrap4.manifest")
- regression.add_check(name="Control Block: Manifest as Argument (Load by Shebang)",
- check=lambda res: "Loaded Manifest: file:./Bootstrap4.manifest" in res[0].log)
- regression.add_check(name="Control Block: Executable as in Manifest (Load by Shebang)",
- check=lambda res: "Loaded Executable: file:Bootstrap" in res[0].log)
- regression.add_check(name="Arguments: loader.execname in Manifest",
- check=lambda res: "argv[0] = Bootstrap" in res[0].log)
- regression.run_checks()
- # Running Bootstrap5.manifest
- regression = Regression(loader, "Bootstrap5.manifest")
- regression.add_check(name="Bootstrap without Executable but Preload Libraries",
- check=lambda res: "Binary 1 Preloaded" in res[0].log and
- "Binary 2 Preloaded" in res[0].log)
- regression.run_checks()
|