Skip to content
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

NONE: fix a bug of the memory checking #452

Merged
merged 2 commits into from
Jun 18, 2019
Merged

NONE: fix a bug of the memory checking #452

merged 2 commits into from
Jun 18, 2019

Conversation

kmyk
Copy link
Member

@kmyk kmyk commented Jun 18, 2019

time コマンドの呼び出したプログラムのリターンコードが非0だった場合にエラーになることに気付きました。次に示すような Command exited with ... という行が紛れ込んできて落ちます。これを修正します。

$ \time -f %M -- perl -e 'die "hoge"'
hoge at -e line 1.
Command exited with non-zero status 255
4840
$ oj t
[*] 3 cases found

[*] sample-1
/usr/bin/../lib/gcc/x86_64-linux-gnu/7.4.0/../../../../include/c++/7.4.0/debug/vector:417:
Error: attempt to subscript container with out-of-bounds index 7, but 
container only holds 7 elements.

Objects involved in the operation:
    sequence "this" @ 0x0x11adf88 {
      type = std::__debug::vector<int, std::allocator<int> >;
    }
Traceback (most recent call last):
  File "/home/user/.local/bin/oj", line 10, in <module>
    sys.exit(main())
  File "/home/user/.local/lib/python3.6/site-packages/onlinejudge/_implementation/main.py", line 284, in main
    run_program(namespace, parser=parser)
  File "/home/user/.local/lib/python3.6/site-packages/onlinejudge/_implementation/main.py", line 263, in run_program
    test(args)
  File "/home/user/.local/lib/python3.6/site-packages/onlinejudge/_implementation/command/test.py", line 213, in test
    history += [test_single_case(name, paths['in'], paths.get('out'), args=args)]
  File "/home/user/.local/lib/python3.6/site-packages/onlinejudge/_implementation/command/test.py", line 137, in test_single_case
    info, proc = utils.exec_command(args.command, stdin=inf, timeout=args.tle, gnu_time=args.gnu_time)
  File "/home/user/.local/lib/python3.6/site-packages/onlinejudge/_implementation/utils.py", line 166, in exec_command
    memory = int(fh1.read()) / 1000  # type: Optional[float]
ValueError: invalid literal for int() with base 10: 'Command terminated by signal 6\n3808\n'

@fukatani これは放置できないのでレビューを待たずにマージしてバージョンを上げます

@kmyk kmyk merged commit 65b49a5 into master Jun 18, 2019
@kmyk kmyk deleted the fix/time branch July 4, 2019 18:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant