summaryrefslogtreecommitdiff
path: root/kpov_judge/tasks
diff options
context:
space:
mode:
Diffstat (limited to 'kpov_judge/tasks')
-rw-r--r--kpov_judge/tasks/copy_rename_20_files_tail_env/task.py23
1 files changed, 17 insertions, 6 deletions
diff --git a/kpov_judge/tasks/copy_rename_20_files_tail_env/task.py b/kpov_judge/tasks/copy_rename_20_files_tail_env/task.py
index 28990fc..64b2a01 100644
--- a/kpov_judge/tasks/copy_rename_20_files_tail_env/task.py
+++ b/kpov_judge/tasks/copy_rename_20_files_tail_env/task.py
@@ -111,7 +111,8 @@ def task(IP_malishell, file_rename_dirname, mv_src_dir, mv_dst_dir, cowsay_strin
conn.prompt()
results['mv_ls_size'] = conn.before
conn.sendline('. ~/mv_ukaz')
- conn.sendline('/bin/ls -l {}'.format(mv_src_dir))
+ conn.prompt()
+ conn.sendline('/bin/ls -a1 {}'.format(mv_src_dir))
conn.prompt()
results['post_mv_src'] = conn.before
conn.sendline('/bin/ls -a1 {}'.format(mv_dst_dir))
@@ -208,11 +209,21 @@ def task_check(results, params):
fnames = []
for i in xrange(40):
fnames.append("".join([ r.choice("123456789abcdefghijk") for j in xrange(8)]))
- print( results['pre_mv_src'])
- print( results['pre_mv_dst'])
- print( results['mv_ls_size'])
- print( results['post_mv_src'])
- print( results['post_mv_dst'])
+ task2_re = re.search(
+ r"-rw[x-][r-][w-][x-][r-][w-][x-] \d* student student (\d*) .*mv_ukaz",
+ results['mv_ls_size'])
+ mv_ls_size = int(task2_re.group(1))
+ task2_ok = mv_ls_size < 15 and mv_ls_size > 2
+ pre_src = set([i.strip() for i in results['pre_mv_src'].split('\n')[3:-1]])
+ pre_dst = set([i.strip() for i in results['pre_mv_dst'].split('\n')[3:-1]])
+ task2_ok = task2_ok and pre_src == set(fnames)
+ task2_ok = task2_ok and len(pre_dst) < 2
+ post_src = set([i.strip() for i in results['post_mv_src'].split('\n')[3:-1]])
+ post_dst = set([i.strip() for i in results['post_mv_dst'].split('\n')[3:-1]])
+ task2_ok = task2_ok and post_dst == set(fnames)
+ task2_ok = task2_ok and len(post_src) < 2
+ if task2_ok:
+ score += 2
# mama_ukaz
#
mama_fnames = []