From e3c9dfd4546251e432a9af1d9a2795abba330a73 Mon Sep 17 00:00:00 2001 From: "gasperfele@fri1.uni-lj.si" Date: Sun, 1 Feb 2015 18:11:54 +0000 Subject: 2nd subtask(mv) finished. git-svn-id: https://svn.lusy.fri.uni-lj.si/kpov-public-svn/kpov-public@262 5cf9fbd1-b2bc-434c-b4b7-e852f4f63414 --- .../tasks/copy_rename_20_files_tail_env/task.py | 23 ++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) (limited to 'kpov_judge/tasks/copy_rename_20_files_tail_env') 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 = [] -- cgit v1.2.1