def test_notify_user(self): host = Host() try: host.set_build_dir(host.find_build_dir()) except Host.ConfigError: return host.notify_user('This is a test', 'This is only a test.')
def main(): parser = Args.make_parser( 'Starts the named fuzzer. Additional arguments are passed through.') args, fuzzer_args = parser.parse_known_args() host = Host() device = Device.from_args(host, args) fuzzer = Fuzzer.from_args(device, args) with Cipd.from_args(fuzzer, args) as cipd: if cipd.install(): device.store(os.path.join(cipd.root, '*'), fuzzer.data_path('corpus')) print('\n****************************************************************') print(' Starting ' + str(fuzzer) + '.') print(' Outputs will be written to:') print(' ' + fuzzer.results()) if not args.foreground: print(' You should be notified when the fuzzer stops.') print(' To check its progress, use `fx fuzz check ' + str(fuzzer) + '`.') print(' To stop it manually, use `fx fuzz stop ' + str(fuzzer) + '`.') print('****************************************************************\n') fuzzer.start(fuzzer_args) title = str(fuzzer) + ' has stopped.' body = 'Output written to ' + fuzzer.results() + '.' print(title) print(body) host.notify_user(title, body) return 0