Commit graph

170 commits

Author SHA1 Message Date
Dennis Felsing 843acf6a5a Use std::size instead of sizeof(a) / sizeof(a[0]) 2022-03-30 18:55:04 +02:00
srdante cb5fab5958 Fix tests 2022-03-28 20:27:14 -03:00
Chairn 5fe3e9af85 clang-format 2022-03-24 17:59:49 +01:00
Chairn 6086893fa6 Renamed all shadowing/shadowed variables 2022-03-24 17:59:49 +01:00
ChillerDragon 99b0eb2819 Add str_startswith_nocase and str_endswith_nocase 2022-03-13 11:42:45 +01:00
Robert Müller 66d64ec3fd Add size checks to CVariableInt::Pack and ::Unpack 2022-03-05 20:49:55 +01:00
ChillerDrgon 064ba50230 Add secure_random_uninit 2022-02-14 12:06:31 +01:00
Zwelf 3ea55dcc0e Record player_ready event in teehistorian 2022-02-07 23:31:46 +01:00
heinrich5991 4d90119f25 Don't flush all files, some improvements to io_sync
- Empty buffers using `io_flush` before calling the OS function for
  syncing the file to disk.
- Fix error return of `io_sync` on Windows.
- Don't indiscriminately flush all files on close.
- Add a test that `io_sync` can return without error.
2022-02-01 02:33:18 +01:00
heinrich5991 7a6f5a8af4 Add a function for getting a handle to the current executable file 2022-01-31 21:31:26 +01:00
heinrich5991 67508adff1 Add function to get the OS version 2022-01-31 03:15:19 +01:00
heinrich5991 810787a905 Fix Serverbrowser.PingCache test on Windows 2022-01-31 03:15:19 +01:00
Dennis Felsing f346e445bd Fix timestamp in record_maps in test (fixes #4631) 2022-01-24 20:58:14 -03:00
Robert Müller 0726703937 fix undefined behavior in byte packing functions, add tests 2021-12-31 13:18:41 +01:00
Robert Müller 07a8d21224 fix argument order in test, use constant 2021-12-27 23:41:52 +01:00
Robert Müller 2ffd0ddae2 fix invalid left shift in CVariableInt::Unpack, add tests 2021-12-27 18:00:15 +01:00
def c76f0f5899 Don't expect "moments ago" string in tests, use regex matcher instead 2021-12-25 02:21:46 +01:00
def 6bb875c660 Don't make score test depend on specific timestamp
Insert current timestamp instead
2021-12-25 01:33:08 +01:00
bors[bot] d4f126810b
Merge #4484 #4486
4484: Add IStorage::FormatTmpPath static method r=heinrich5991 a=def-

Not sure I prefer it, but now it's done. Any opinions?

<!-- What is the motivation for the changes of this pull request -->

## Checklist

- [ ] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test if it works standalone, system.c especially
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


4486: Add .a files to .gitignore r=def- a=heinrich5991

<!-- What is the motivation for the changes of this pull request -->

## Checklist

- [ ] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test if it works standalone, system.c especially
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


Co-authored-by: def <dennis@felsin9.de>
Co-authored-by: heinrich5991 <heinrich5991@gmail.com>
2021-12-21 10:30:12 +00:00
def 1a02a20fa6 Add IStorage::FormatTmpPath static method
Not sure I prefer it, but now it's done. Any opinions?
2021-12-20 16:12:15 +01:00
heinrich5991 2fbd0c6c71 Fix formatting in src/test/score.cpp 2021-12-20 14:04:41 +01:00
bors[bot] ec0d1172eb
Merge #4481
4481: Don't create cut off UTF-8 sequences on string manipulation r=def- a=heinrich5991

CC #4463
CC #4465 

## Checklist

- [ ] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [x] Written a unit test if it works standalone, system.c especially
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


Co-authored-by: heinrich5991 <heinrich5991@gmail.com>
2021-12-20 08:58:55 +00:00
heinrich5991 58533cddef Fix string functions not to truncate in the middle of a UTF-8 character
This makes `str_utf8_copy` obsolete.
2021-12-20 02:34:02 +01:00
heinrich5991 ae9944550c Add a function to fix UTF-8 truncation at the end of a string
This can be used after truncating at byte boundaries.
2021-12-20 02:05:07 +01:00
def 3f03d8ee31 Get rid of useless semicolon in SQL queries 2021-12-20 00:50:59 +01:00
def 6feb1a0eee Create connections as unique_ptrs directly
no more leak in test/score.cpp
2021-12-19 23:04:12 +01:00
def f464f148ac Add explicit -DTEST_MYSQL
Since the setup is a bit more manual and not as self-contained, so most
probably don't want to test it locally.
2021-12-19 19:40:20 +01:00
def 04594397ca Test MySQL centrally in fancy 2021-12-19 19:40:20 +01:00
def f5d59e8719 Rename CONF_SQL to CONF_MYSQL 2021-12-19 19:40:20 +01:00
def 9ef5849f0c Add MySQL test support 2021-12-19 19:40:20 +01:00
def e569354f3e Fix TeamScore tests 2021-12-19 19:40:20 +01:00
def 20c9141b71 Remove gmock dependency 2021-12-19 19:40:20 +01:00
def d9858c2010 Add more Score tests, shorten tests 2021-12-19 19:40:20 +01:00
def 41910ff5fd Add sqliteversion test 2021-12-19 19:40:20 +01:00
def 010ecd0868 More output in score test 2021-12-19 19:40:20 +01:00
def baf9b94f2c Factor CScoreWorker out of CScore, add SaveScore test 2021-12-19 19:40:20 +01:00
heinrich5991 49c861372a Add a flag to skip a UTF-8 BOM when opening files for reading
https://en.wikipedia.org/w/index.php?title=Byte_order_mark&oldid=1059783325#UTF-8

This allows to read text files created by Windows users transparently,
even if they contain a UTF-8 BOM.
2021-12-17 22:07:01 +01:00
bors[bot] d862207a73
Merge #4405
4405: Try to use unique_ptr in tests so we can't forget to delete r=heinrich5991 a=def-

Why is the PingCache test failing now???

<!-- What is the motivation for the changes of this pull request -->

## Checklist

- [ ] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test if it works standalone, system.c especially
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


Co-authored-by: def <dennis@felsin9.de>
2021-12-10 02:53:55 +00:00
Robert Müller f20443b694 fix command line arguments with unicode on windows
Co-authored-by: heinrich5991 <heinrich5991@gmail.com>
2021-12-06 19:48:25 +01:00
def 4ac5ca1449 Try to use unique_ptr in tests so we can't forget to delete 2021-11-29 00:40:10 +01:00
def 87a089c4aa test/serverbrowser: delete pConsole
==235823==ERROR: LeakSanitizer: detected memory leaks

Indirect leak of 65632 byte(s) in 1 object(s) allocated from:
    #0 0x563636cc2fc9 in malloc (/media/ddnet/testrunner+0x37afc9)
    #1 0x563636e0fd89 in CHeap::NewChunk() /media/ddnet/src/engine/shared/memheap.cpp:14:17
    #2 0x563636e10aee in CHeap::Reset() /media/ddnet/src/engine/shared/memheap.cpp:63:2
    #3 0x563636d954a5 in CConsole::CExecutionQueue::Reset() /media/ddnet/src/engine/shared/console.h:188:12
    #4 0x563636d4a272 in CConsole::CConsole(int) /media/ddnet/src/engine/shared/console.cpp:937:19
    #5 0x563636d88a98 in CreateConsole(int) /media/ddnet/src/engine/shared/console.cpp:1230:59
    #6 0x563636fbe915 in ServerBrowser_PingCache_Test::TestBody() /media/ddnet/src/test/serverbrowser.cpp:13:23
    #7 0x7f0a2f87fe26 in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) (/usr/lib/libgtest.so.1.11.0+0x54e26)
2021-11-28 15:51:31 +01:00
Robert Müller 84ecbdb9d0 add str_utf8_stats to base system 2021-11-24 23:24:46 +01:00
heinrich5991 1bffc6ebfc teehistorian: Test statefulness of PLAYER_TEAM and TEAM_PRACTICE 2021-10-06 18:06:19 +02:00
heinrich5991 fbb98c8801 teehistorian: Test no-op function calls as well 2021-10-06 17:33:22 +02:00
bors[bot] 121c6d16f6
Merge #3879 #4079
3879: Use SDL_FlashWindow to request user's attention r=heinrich5991 a=Jupeyy

We should soon update to SDL 2.0.16 for our bundled libs, but don't merge before this happened.

This drops the remaining X11 dependency.

We should then also use GLEW with EGL for official builds for easy native wayland support(which i discussed before already)

## Checklist

- [x] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test if it works standalone, system.c especially
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


4079: Make teehistorian easier to reproduce r=heinrich5991 a=Zwelf

I've tested it ingame, but still have to make sure, that the ordering of the teehistorian messages are right. I would be really happy if we could land this before changing team joining logic (#4006 or /practice logic, but there isn't a pr for this yet), but I would like to make sure that the change is correct.

## Checklist

- [x] Tested the change ingame
- [ ] Tested in combination with possibly related configuration options
- [x] Written a unit test if it works standalone, system.c especially
- [x] Considered possible null pointers and out of bounds array indexing
- [x] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


Co-authored-by: Jupeyy <jupjopjap@gmail.com>
Co-authored-by: Zwelf <zwelf@strct.cc>
2021-10-06 14:52:39 +00:00
Zwelf e9dec007b2 Address review to make code more consistent 2021-09-15 17:31:35 +02:00
Zwelf 81f4263428 Record team practice mode making replay easier 2021-09-14 22:10:43 +02:00
heinrich5991 9b4b0cd4eb Remove a #include <base/system.h>
The variable isn't actually a path, just the test name formatted as file
name, so the 64 isn't actually too strict.
2021-09-13 12:40:40 +02:00
ChillerDragon 3eb3dcd48b Make use of IO_MAX_PATH_LENGTH
Inspired by
0a7d0fee7c
2021-09-13 12:14:50 +02:00
Zwelf d6912f7ced Record team change in teehistorian 2021-08-14 15:22:13 +02:00