summaryrefslogtreecommitdiff
path: root/kpov_judge
diff options
context:
space:
mode:
authorgasperfele@fri1.uni-lj.si <gasperfele@fri1.uni-lj.si@5cf9fbd1-b2bc-434c-b4b7-e852f4f63414>2015-02-01 18:11:54 +0000
committergasperfele@fri1.uni-lj.si <gasperfele@fri1.uni-lj.si@5cf9fbd1-b2bc-434c-b4b7-e852f4f63414>2015-02-01 18:11:54 +0000
commite3c9dfd4546251e432a9af1d9a2795abba330a73 (patch)
tree0e059b06bbc2e4aa7a0f1a788a68caae373f4b52 /kpov_judge
parent2133ae0726e6e90800187c6008b01bc65afa0438 (diff)
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
Diffstat (limited to 'kpov_judge')
-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 = []