diff options
Diffstat (limited to 'kpov_judge/tasks/copy_rename_20_files_tail_env')
-rw-r--r-- | kpov_judge/tasks/copy_rename_20_files_tail_env/task.py | 40 |
1 files changed, 11 insertions, 29 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 d7f0cc6..b7970e7 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 @@ -118,9 +118,16 @@ params_meta = { def task(IP_malishell, file_rename_dirname, mv_src_dir, mv_dst_dir, cowsay_string, curl_fname, wc_dirname): import collections import os - from pexpect import pxssh - commands = [ + # TOD: (polz) this has to be changed! Get a move on! + # + # sv: Z primozem lavricem sva skusala nekaj narediti + # Ker gen params ni narejen, sklepam da je "Mapa" na namizju, + # imena datotek pa so: 1,1-,2,2-,3,3-,4,5,6,7,8,9,.mama1,mama2,mama3,mama4,mama5,mojimenik,novi,oce1 + # v mojimenik se nahaja mojimenikfile + # mama2 vsebuje "mama" + #Stirje subt-aski dodani.By Mihec. + results = kpov_util.ssh_test(IP_malishell, 'student', 'vaje', ( ('preimenuj', '/bin/ls -a1 {}'.format(file_rename_dirname)), ('pre_mv_src', '/bin/ls -a1 {}'.format(mv_src_dir)), ('pre_mv_dst', '/bin/ls -a1 {}'.format(mv_dst_dir)), @@ -144,29 +151,7 @@ def task(IP_malishell, file_rename_dirname, mv_src_dir, mv_dst_dir, cowsay_strin ('cowsay', 'cowsay "{}"'.format(cowsay_string)), ('wc_origfile', 'cat {}/count.txt'.format(wc_dirname)), ('wc_lines', 'cat {}/lines.txt'.format(wc_dirname)), - ] - - # TOD: (polz) this has to be changed! Get a move on! - # - # sv: Z primozem lavricem sva skusala nekaj narediti - # Ker gen params ni narejen, sklepam da je "Mapa" na namizju, - # imena datotek pa so: 1,1-,2,2-,3,3-,4,5,6,7,8,9,.mama1,mama2,mama3,mama4,mama5,mojimenik,novi,oce1 - # v mojimenik se nahaja mojimenikfile - # mama2 vsebuje "mama" - #Stirje subt-aski dodani.By Mihec. - results = collections.defaultdict(str) - try: - s = pxssh.pxssh(encoding='utf-8') - s.login(IP_malishell, 'student', 'vaje') - results['ssh'] = True - for test, command in commands: - s.sendline(command) - s.prompt() - if test: - results[test] = s.before - s.logout() - except Exception as ex: - results['ssh'] = str(ex) + )) try: results['curl_env'] = os.environ['images'] @@ -309,11 +294,8 @@ def task_check(results, params): else: hints += ["wrong image count"] task6_ok = True - wc_cat_str = 'cat {}/lines.txt'.format(params['wc_dirname']) - if not wc_cat_str == results['wc_lines'][:len(wc_cat_str)]: - task6_ok = False try: - assert int(results['wc_lines'][len(wc_cat_str):].strip()) == int(params['wc_n_lines']) + assert int(results['wc_lines'].strip()) == int(params['wc_n_lines']) except: task6_ok = False if task6_ok: |