-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Introduce dev-tools/harness.js
for testing/benchmarking
#5370
Conversation
This could have caught the crashes from the server restarts today (provided it ran long enough and the PRNG was in its favor to give a mon 'Leech Seed' etc). I think to be more generally useful for smoke tests we should create a random team generator which doesn't aim to build 'good' mons, but instead aims for coverage - just making sure we have the best chance of playing battles with the most Pokemon/Moves/Abilities etc. Obviously we wouldn't be able to test each combination and interplay of factors, but just making sure we've used all 1000+ Pokemon and 1000+ moves would only take < 100 custom games (1000/12 with no team validation) which takes about 15s to run and would give us some confidence that we can at least avoid crashes. We could do this for each format (not just the random formats), including OMs and it would still take < 10 minutes. Definitely not something to run on each commit, but something that could be used to know if restarting the server will crash on battles on not. Creating such a generator is out of scope for this PR, but where I think would be useful to take this on the testing front. |
That's the Hackmons Cup generator. |
Made a strawman prototype team generator inspired by Hackmons Cup ( EDIT: 6e3f5e8 is my WIP smoke test using the generator and runner. |
Also fixes an issue with error accounting in async mode.
@Zarel - PTAL when you're feeling better. I'm worried you'll confuse this for the perma-WIP #5278 which used to have this title. My 'smoke test project' (which will follow up on this PR) is going well - I've got it running on all the singles formats pretty well (logs). Doubles is proving to be troublesome (possibly a bug in the AI, given the logs), the pool sampling could maybe be improved (eg. 1516-1590, where it seems stuck not using one move for a while), and I need to fix logging/repeatability (in particular, when the bug occurs at the wrong level, like its doing now. Error logging/reproduction works well if the problem is in |
This seems to still be happening |
@Slayer95 - thats the same error I'm seeing on #5370 (comment), and I thought I fixed it in the past on #5278. Maybe I didn't port everything relevant over from that PR. |
Oh, right! That's a Doubles format. Just posted to make sure you didn't miss it. |
Should I wait until the Doubles issue is fixed...? |
Its not like anything breaks if this gets committed as is, but its OK if you want to hold off, I'm working to fix the bug now. |
134fb8b is what fixed the push after end of stream last time. Commenting out the |
And this seems to still have memory issues (now running without Notes
PS. Run actually just finished, memory usage didn't get a chance to increase anymore, and it dropped to 40 MB afterwards as expected. |
https://gist.github.com/scheibo/84e0331f38f724646824a29776cb0f89 is a repro of the push after stream that can be fed into I've also made
OK, so these are definitely conditions I didn't account for! I've never run it for more than 5 minutes (2000 battles), and my computers have 16GB and 64GB respectively. I will look into this. |
No, that check is fine. |
Ah, because it should just be |
No, active Pokémon cannot contain |
I really need to go to bed, but #5381 was a pretty simple fix. Unfortunately, my 'push after stream' error no longer repros with that (the battles play out successfully), but I need to fix the 'push after stream' error as well. For my own reference, for this PR I want to fix:
The AI doesn't look like it will handle triple/rotation/multi battles very well either, but that's out of scope for now. In my
|
We need to listen to the
You don't need to worry about that. If there is a mismatch between item and Pokémon, the request has the |
Ah, was not aware of those. I don't think theyre documented in
We already handle this, I think?
I'm not worried about the AI not handling mega evolution properly (it does it correctly already), I'm worried that in my |
I keep on forgetting |
eb9e76e removes Once #5394 lands, all outstanding issues will have been fixed, at which point @Zarel should be able to merge this and I can send out my next PR for the more elaborate smoke testing code (which already found an honest-to-goodness crash! Yay!) |
This pull request introduces 2 alerts when merging f767526 into ac5c0a5 - view on LGTM.com new alerts:
Comment posted by LGTM.com |
There's a |
Because LGTM is not ESLint ;) |
I should have rephrased as "I think LGTM should understand ESLint directives given its widely used and having to ignore the same violation two different ways is obnoxious" |
This pull request introduces 2 alerts when merging f393bc7 into 2978546 - view on LGTM.com new alerts:
Comment posted by LGTM.com |
It no longer reports the error locations, but it still counts them. LGTM EDIT: It should probably be |
What does LGTM buy us that Travis running our linter and tests doesn't? |
This pull request introduces 2 alerts when merging 3669dc1 into a53d6a8 - view on LGTM.com new alerts:
Comment posted by LGTM.com |
Who knows ! |
This pull request introduces 2 alerts when merging f242844 into 0f82410 - view on LGTM.com new alerts:
Comment posted by LGTM.com |
// Tracks whether some promises threw errors that weren't caught so we can log | ||
// and exit with a non-zero status to fail any tests. This "shouldn't happen" | ||
// because we're "great at propagating promises (TM)", but better safe than sorry. | ||
const RejectionTracker = { |
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.
Hm, you recently switched this from new class {
to {
. Want to talk about your reasoning?
I'm still undecided which is better. I'm leaning towards new class {
because it feels more natural in TypeScript.
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.
There's also class
with literally everything static
. Which is also an option I'm undecided about.
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.
#5370 (comment) is what prompted it. IMO, an object is the simplest way - static
or new class
just add extra noise.
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.
I'm also happy to follow up and bikeshed this to look however you want, but I have several PRs blocked on this landing so it would be awesome if we could merge first and argue over the insignificant bits later :)
@scheibo, LGTM is a static code analyzer, it finds flaws that our linter and tests can't. I've had it dig up a few bugs that even TSLint isn't capable of seeing, bugs involving variables being guaranteed to be a specific value at a specific point. After repeated complaints I thought I got them to support ESLint syntax for unused variables, though? |
Also, the "introduces 2 alerts" message is counting suppressed alerts. They won't show up in the main LGTM page; it's just here so you can't slip bad code past me, I think. |
Originally posted by @scheibo in #5278 (comment)
I keep finding new yaks to shave with benchmarking/profiling, but this works as is for testing.