Skip to content

Commit f1b0997

Browse files
committed
feat: support for new hunter log format; updated manafa
1 parent 997455e commit f1b0997

File tree

10 files changed

+12
-11
lines changed

10 files changed

+12
-11
lines changed

anadroid/Anadroid.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ def get_projs_from_last_run(self):
376376

377377
def get_last_run_file(self):
378378
run_regex = r"\d+-\d+-\d+-\d+-\d+.*.log"
379-
prev_logs = list(filter(lambda t : re.search(run_regex, t), mega_find(get_log_dir(), pattern='*.log', type_file='f', maxdepth=1)))
379+
prev_logs = list(filter(lambda t: re.search(run_regex, t), mega_find(get_log_dir(), pattern='*.log', type_file='f', maxdepth=1)))
380380
if len(prev_logs) == 0:
381381
return None
382382
sorted_list = sorted(prev_logs, key=os.path.getmtime)

anadroid/device/DeviceState.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,6 @@ def set_screen_brightness(self, value=0):
213213
res = self.device.execute_command(f"settings put system screen_brightness {value}", shell=True)
214214
res.validate(("unable to set brightness value of %d " % value))
215215
self.screen_brightness = value
216-
print("olaaa")
217216

218217
def set_screen_always_on_while_plugged(self, value=0):
219218
"""set screen always on state. if state = 1 set stay on value.

anadroid/instrument/JInstInstrumenter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def __update_dependencies_and_plugins(self, instr_type=INSTRUMENTATION_TYPE.TEST
4545
self.classpath_dependencies = []
4646
self.build_plugins = []
4747
if instr_type == INSTRUMENTATION_TYPE.ANNOTATION:
48-
self.build_dependencies.append(BuildDependency("io.github.raphael28:hunter-debug-library", version="1.0.1"))
48+
self.build_dependencies.append(BuildDependency("io.github.greensoftwarelab:hunter-emanafa-library", version="1.0.1"))
4949
self.classpath_dependencies.append(
5050
BuildDependency("io.github.raphael28:hunter-debug-plugin", dep_type=DependencyType.CLASSPATH,
5151
version="1.0.1"))

anadroid/results_analysis/LogAnalyzer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def analyze_test(self, app, log_file, output_filename=None, **kwargs):
3939

4040
def clean(self):
4141
super().clean()
42-
#self.logcatparser = LogCatParser(log_format="threadtime")
42+
self.logcatparser = LogCatParser(log_format="threadtime")
4343

4444
def show_results(self, app_list):
4545
#for analyzed_app in app_list:

anadroid/results_analysis/ManafaAnalyzer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def analyze_tests(self, app, results_dir=None, **kwargs):
3030
results_dir = results_dir if results_dir is not None else app.curr_local_dir
3131
if isinstance(self.profiler.manafa, HunterEManafa):
3232
hunter_trace = {}
33-
output_log_file = "hunter.log"
33+
output_log_file = self.profiler.manafa.bts_out_file.replace("bstats", "hunter")
3434
hunter_logs = [os.path.join(results_dir, f) for f in os.listdir(results_dir) if 'hunter' in f]
3535
final_hunter = os.path.join(results_dir, output_log_file)
3636
# concat all hunter logs on final hunter

anadroid/testing_framework/MonkeyFramework.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,9 @@ def exec_one_test(self, test_id, device, app, wk_unit, n_retries=1):
103103
device.unlock_screen()
104104
time.sleep(1)
105105
self.profiler.init(**{'app': app})
106+
log_file = os.path.join(app.curr_local_dir, f"test_{test_id}.logcat")
106107
self.profiler.start_profiling()
107108
app.start()
108-
log_file = os.path.join(app.curr_local_dir, f"test_{test_id}.logcat")
109109
self.execute_test(app.package_name, wk_unit, **{'log_filename': log_file})
110110
app.stop()
111111
self.profiler.stop_profiling()

anadroid/testing_framework/work/DroidBotWorkUnit.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ def execute(self, extras=None, *args, **kwargs):
2121
cmd = self.command
2222
if extras:
2323
cmd = f'{cmd} {extras}'
24+
2425
execute_shell_command(cmd).validate(("Error executing command " + cmd))
2526

2627
def config(self, id=None, **kwargs):

anadroid/testing_framework/work/MonkeyWorkUnit.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def __init__(self, bin_cmd):
4444

4545
def execute(self, package_name, *args, **kwargs):
4646
el_commandant = self.command % package_name
47-
print("executing command: " + el_commandant)
47+
#print("executing command: " + el_commandant)
4848
execute_shell_command(el_commandant).validate(("Error executing command " + el_commandant))
4949

5050
def config(self, seed=None, **kwargs):

anadroid/utils/Utils.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,10 @@ def getColor(sev):
2727
}.get(sev, 'green')
2828

2929

30-
def log(message, log_sev=LogSeverity.INFO, time=time.time(), to_file=True):
30+
def log(message, log_sev=LogSeverity.INFO, curr_time=None, to_file=True):
31+
curr_time = time.time() if curr_time is None else curr_time
3132
color = getColor(log_sev.value)
32-
adapted_time = re.sub("\s|:", "-", str(datetime.fromtimestamp(time)))
33+
adapted_time = re.sub("\s|:", "-", str(datetime.fromtimestamp(curr_time)))
3334
str_to_print ="[%s] %s: %s" % (log_sev.value, adapted_time, message)
3435
print(colored(str_to_print, color))
3536
if to_file:

requirements.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ androguard==3.4.0a1
22
incremental>=17.5.0
33
lxml==4.6.5
44
six>=1.15.0
5-
manafa>=0.3.108
5+
manafa>=0.3.112
66
physalia==0.0.1.dev122
77
termcolor==1.1.0
8-
pylogcatparser==0.2.4
8+
pylogcatparser>=0.2.6

0 commit comments

Comments
 (0)