diff options
-rw-r--r-- | kpov_judge/tasks/copy_rename_20_files_tail_env/task.py | 34 |
1 files 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']) |