-
Notifications
You must be signed in to change notification settings - Fork 94
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] oj testでディレクトリ指定できないバグ修正 #233
Conversation
table = {} | ||
table['s'] = '(?P<name>.+)' | ||
table['e'] = '(?P<ext>in|out)' | ||
pattern = re.compile('^' + utils.parcentformat(format, table) + '$') | ||
path = path.absolute().relative_to(directory.absolute()).resolve() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pathにはcutils.glob_with_format(args.directory, args.format)の結果が入っていて
/home/ryo/work/github/rust-debug/src/test/sample1.inが格納されており、
directoryには/home/ryo/work/github/rust-debug/src/testが入っています。
この2つにrelativeをとると、'sample1.in'になり/home/ryo/work/github/rust-debug/src/sample-1.inをresolveするようにみえました。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
formatがディレクトリを複数含んでいる場合、それに応じてサーチの際のルートディレクトリが変わるので、ベタに数えてカウントアップしてしまいました。
ただ、formatが"./"や"/"(システムのルートディレクトリ)から始まることはあるでしょうか?
-dから相対パスで探すものと仮定してコード書きました。
ありがとうございます。 ただCIが型チェックで落ちてるのと、他にもまだバグが残ってるのでまだmergeはできなさそうです。 他のバグとは、ケース名の取得が壊れている (下図) のと、 誤: [*] /home/user/GitHub/online-judge-tools/foo/sample-1
[x] time: 0.003562 sec
[+] AC 正: [*] sample-1
[x] time: 0.003562 sec
[+] AC |
テストを書きました。 (#235) (CIが落ちるため やってもらえるなら任せたいですが、バージョン依存は少ないはずなので続きは私にパスしてもらってもかまいません (せっかく直してもらったのに追加になってしまって申し訳なさがあるため)。どうしますか? |
テスト追加ありがとうございます。 このPRもWIPのつもりで、「こんな感じでしょうか?」というつもり出したので、全然問題ないです。 |
それならよかったです。では続きは任せます。 |
work -d ./test/sample.in
|
||
def test_call_test_dir(self): | ||
self.snippet_call_test( | ||
args=[ '-c', 'cat', '-d', 'p/o/../../p/o/y/o' ], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
もともとはpath/toでしたが、そのようなディレクトリが存在しないことがエラーの原因なので、
テストケースを修正しました。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
これ知らなかったです。
Python 3.6のresolve()はいい感じにしてくれるけど3.5はだめ、普通のcatとかlsとかは同じエラーを吐くので、この修正は妥当そう。
generate-outputのテストも作成中です |
CI通ってるのでひとまずmergeします。 generate-outputの方も壊れてるかもしれませんが、別のプルリクに分けましょう。 |
generate-outputのテストも書いてくれる (感謝) とのことなので、これができたらバージョン上げます |
/home/ryo/work/github/rust-debug/src/
というディレクトリにおいて
oj test -c ./a.out -d ./testを行うと、
というエラーが発生します。
私がローカルで修正を試みたパッチを添えておきます。
実行環境: Python 3.5、https://atcoder.jp/contests/arc087/tasks/arc087_b の問題をダウンロード