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

How to get this to work? #1

Open
ratiotile opened this issue Mar 8, 2021 · 1 comment
Open

How to get this to work? #1

ratiotile opened this issue Mar 8, 2021 · 1 comment

Comments

@ratiotile
Copy link

I am new to OpenBW and interested in how it can be used to make specific in-game tests. Is this project supposed to run, or is it just some code samples put together so people can get an idea of what is needed to accomplish this?

On Windows, the tests module needs to be rewritten due to lack of fork(). Using CLion on linux, I made a few changes to get compiled: https://github.com/ratiotile/StardustDevEnvironment/tree/linux

Also, 'tests' builds a shared library, where it's supposed to be an executable. Somehow CLion still manages to run 'tests', but I can't see how to run manually. On Windows, cmake builds a 'tests.exe' executable file.

However CLion is able to run it and now 'tests' segfaults on FAP initialization.
Process finished with exit code 139 (interrupted by signal 11: SIGSEGV)
In the debugger it just points to the definition of FastAPproximation::FastAPproximation() { in FAP.cpp

Another mystery is I don't see where LLVM is used, and the project compiles without it.

@bmnielsen
Copy link
Owner

Hello,

Yes the project is intended to run, but I haven't tried running the tests on Windows or Linux.

The reason for using fork in the test infrastructure is to give the opponent bot a clean address space for each test case. Many or most bots expect to only be playing one game and therefore store stuff in global state that doesn't get cleaned up at the end of the game. So running them in a separate process ensures they get this global state cleared between games.

On Windows it might be possible to just remove the fork and accept that you will only be able to run one game per test case, though you probably still need to start a separate thread for each bot loop.

I'm unfortunately not sure what the segfault is on Linux, as I don't have a machine to test with and am not the original developer of FAP.

I'm also unsure why it would build a shared library, as it is using add_executable in the CMakeLists of tests. It builds an executable on my Mac.

It should be said though that this project is the only time I've ever used CMake, so it's not unlikely there are errors somewhere that could cause something like this.

Finally, without LLVM on my Mac it fails to link, so perhaps it needs it to get some standard libraries there that available elsewhere on your Linux distribution. I'm not explicitly using anything specific to LLVM as far as I know.

Hope this helps and good luck!

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

No branches or pull requests

2 participants