From b5c1a3bd1ff20a8153f1525f373bd0773372547b Mon Sep 17 00:00:00 2001 From: "gasperfele@fri1.uni-lj.si" Date: Wed, 4 Feb 2015 10:08:02 +0000 Subject: Continuing work on subtask 3 (grep) git-svn-id: https://svn.lusy.fri.uni-lj.si/kpov-public-svn/kpov-public@267 5cf9fbd1-b2bc-434c-b4b7-e852f4f63414 --- .../tasks/copy_rename_20_files_tail_env/task.py | 34 +++++++++++++--------- 1 file changed, 21 insertions(+), 13 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 64b2a01..25243c5 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 @@ -122,17 +122,14 @@ def task(IP_malishell, file_rename_dirname, mv_src_dir, mv_dst_dir, cowsay_strin # conn.sendline('cd /home/student/grep_test_dir') conn.prompt() - conn.sendline('grep "mama" * > /dev/null 2>&1') - conn.prompt() - results['grep_err'] = conn.before - conn.sendline('grep "mama" * 2> /dev/null') - conn.prompt() - results['grep_stdout'] = conn.before conn.sendline('. ~/mama_ukaz') conn.prompt() - conn.sendline('cat ~/mama.txt ~/napake.txt') + conn.sendline('cat ~/napake.txt') + conn.prompt() + results['grep_napake'] = conn.before + conn.sendline('cat ~/mama.txt') conn.prompt() - results['grep_result'] = conn.before + results['grep_mama'] = conn.before # sledenje syslog conn.sendline('date') conn.prompt() @@ -226,21 +223,32 @@ def task_check(results, params): score += 2 # mama_ukaz # + task3_ok = True mama_fnames = [] for i in xrange(20): - fnames.append("".join([ r.choice("123456789abcdefghijk") for j in xrange(8)])) + mama_fnames.append("".join([ r.choice("123456789abcdefghijk") for j in xrange(8)])) papa_fnames = [] for i in xrange(20): - fnames.append("".join([ r.choice("123456789abcdefghijk") for j in xrange(8)])) + papa_fnames.append("".join([ r.choice("123456789abcdefghijk") for j in xrange(8)])) dirnames = [] for i in xrange(20): dirnames.append("".join([ r.choice("123456789abcdefghijk") for j in xrange(8)])) linknames = [] for i in xrange(20): linknames.append("".join([ r.choice("123456789abcdefghijk") for j in xrange(8)])) - print( results['grep_err']) - print( results['grep_stdout']) - print( results['grep_result']) + print( results['grep_mama']) + print( results['grep_napake']) + for i in dirnames + linknames: + if results['grep_napake'].find(i) < 0: + task3_ok = False + if results['grep_mama'].find(i) >= 0: + task3_ok = False + for i in papa_fnames: + if results['grep_napake'].find(i) < 0: + task3_ok = False + if results['grep_mama'].find(i) >= 0: + task3_ok = False + # sledenje syslog print( results['syslog_start_time']) print( results['syslog_result']) -- cgit v1.2.1