Backed out changeset bcbab342eed8 (bug 1889658) for causing wpt reftest failures...
[gecko.git] / testing / mozharness / examples / verbose_script.py
blobf30ed8f5d5d461c160f8c7e874c9d84ae356ee68
1 #!/usr/bin/env python
2 # This Source Code Form is subject to the terms of the Mozilla Public
3 # License, v. 2.0. If a copy of the MPL was not distributed with this
4 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
6 """verbose_script.py
8 Contrast to silent_script.py.
9 """
11 import os
12 import sys
14 sys.path.insert(1, os.path.dirname(sys.path[0]))
16 # from mozharness.base.errors import TarErrorList, SSHErrorList
17 from mozharness.base.script import BaseScript
20 # VerboseExample {{{1
21 class VerboseExample(BaseScript):
22 def __init__(self, require_config_file=False):
23 super(VerboseExample, self).__init__(
24 all_actions=[
25 "verbosity",
27 require_config_file=require_config_file,
28 config={"tarball_name": "bar.tar.bz2"},
31 def verbosity(self):
32 tarball_name = self.config["tarball_name"]
33 self.download_file(
34 "http://people.mozilla.org/~asasaki/foo.tar.bz2", file_name=tarball_name
36 # the error_list adds more error checking.
37 # the halt_on_failure will kill the script at this point if
38 # unsuccessful. Be aware if you need to do any cleanup before you
39 # actually fatal(), though. If so, you may want to either use an
40 # |if self.run_command(...):| construct, or define a self._post_fatal()
41 # for a generic end-of-fatal-run method.
42 self.run_command(
43 ["tar", "xjvf", tarball_name],
44 # error_list=TarErrorList,
45 # halt_on_failure=True,
46 # fatal_exit_code=3,
48 self.rmtree("x/ship2")
49 self.rmtree(tarball_name)
50 self.run_command(
51 ["tar", "cjvf", tarball_name, "x"],
52 # error_list=TarErrorList,
53 # halt_on_failure=True,
54 # fatal_exit_code=3,
56 self.rmtree("x")
57 if self.run_command(
58 ["scp", tarball_name, "people.mozilla.org:public_html/foo2.tar.bz2"],
59 # error_list=SSHErrorList,
61 self.error(
62 "There's been a problem with the scp. We're going to proceed anyway."
64 self.rmtree(tarball_name)
67 # __main__ {{{1
68 if __name__ == "__main__":
69 verbose_example = VerboseExample()
70 verbose_example.run_and_exit()