summaryrefslogtreecommitdiff
path: root/Tests
AgeCommit message (Collapse)Author
2022-11-23Userland+Tests: Remove a few more LibJS/{AST.h,Parser.h} includesAndreas Kling
2022-11-23LibJS+LibWeb: Make CyclicModule.h not include AST.hAndreas Kling
This led to some fallout as many things in LibJS and LibWeb were pulling in other things via CyclicModule.h
2022-11-19LibC+Tests: Simplify getpwuid_r() and getpwnam_r() and add testsAndreas Kling
These functions are now implemented in terms of getpwent_r() which allows us to remove two FIXMEs about global variable shenanigans. I'm also adding tests for both APIs. :^)
2022-11-18AK: Add JSON object/array for-each methods for fallible callbacksTimothy Flynn
This allows the provided callback to return an ErrorOr-like type to propagate errors back to the caller.
2022-11-15Tests/AK: Re-enable `HashTable<double>` testDaniel Bertalan
The incorrect UBSan alignment check that made this test fail has been fixed in Clang 15. Closes #13614
2022-11-11AK: Add optional explicit cast to underlying type to DistinctNumericSam Atkins
2022-11-11AK+Everywhere: Replace DistinctNumeric bool parameters with named onesSam Atkins
This means that rather than this: ``` AK_TYPEDEF_DISTINCT_NUMERIC_GENERAL(u64, true, true, false, false, false, true, FunctionAddress); ``` We now have this: ``` AK_TYPEDEF_DISTINCT_NUMERIC_GENERAL(u64, FunctionAddress, Arithmetic, Comparison, Increment); ``` Which is a lot more readable. :^) Co-authored-by: Ali Mohammad Pur <mpfard@serenityos.org>
2022-11-11AK: Don't crash in HashTable::clear_with_capacity on an empty tableZaggy1024
When calling clear_with_capacity on an empty HashTable/HashMap, a null deref would occur when trying to memset() m_buckets. Checking that it has capacity before clearing fixes the issue.
2022-11-10AK: Allow Variant::downcast<OtherVariantType>()Ali Mohammad Pur
We usually give type aliases to variants, so their variant types are not always available, so make it possible to downcast to another variant type.
2022-11-09LibRegex: Don't treat ForkReplace* as new forksAli Mohammad Pur
2022-11-03AK: Add framework for a unified floating point to string conversionDan Klishch
Currently, the floating point to string conversion is implemented several times across the codebase. This commit provides a pretty low-level function to unify all of such conversions. It converts the given double to a fixed point decimal satisfying a few correctness criteria.
2022-11-02LibCrypto: Add a way to compare UnsignedBigInteger with doubleMoustafa Raafat
This patch also make SignedBigInteger::compare_to_double make use of the new function.
2022-11-01Everywhere: Mark dependencies of most targets as PRIVATETim Schumacher
Otherwise, we end up propagating those dependencies into targets that link against that library, which creates unnecessary link-time dependencies. Also included are changes to readd now missing dependencies to tools that actually need them.
2022-11-01Everywhere: Explicitly link all binaries against the LibC targetTim Schumacher
Even though the toolchain implicitly links against -lc, it does not know where it should get LibC from except for the sysroot. In the case of Clang this causes it to pick up the LibC stub instead, which might be slightly outdated and feature missing symbols. This is currently not an issue that manifests because we pass through the dependency on LibC and other libraries by accident, which causes CMake to link against the LibC target (instead of just the library), and thus points the linker at the build output directory. Since we are looking to fix that in the upcoming commits, let's make sure that everything will still be able to find the proper LibC first.
2022-10-31LibVideo: Add VideoFrame class for decoded video framesZaggy1024
The class is virtual and has one subclass, SubsampledYUVFrame, which is used by the VP9 decoder to return a single frame. The output_to_bitmap(Bitmap&) function can be used to set pixels on an existing bitmap of the correct size to the RGB values that should be displayed. The to_bitmap() function will allocate a new bitmap and fill it using output_to_bitmap. This new class also implements bilinear scaling of the subsampled U and V planes so that subsampled videos' colors will appear smoother.
2022-10-27Tests: Add pthread scheduler priority testskleines Filmröllchen
2022-10-25Tests: Use new global variables at /sys/kernel/ directoryLiav A
2022-10-24AK: Add SplitBehavior::KeepTrailingSeparator with testsdemostanis
2022-10-24AK+Everywhere: Turn bool keep_empty to an enum in split* functionsdemostanis
2022-10-23AK: Make the JsonParser use the new double parser for numbersdavidot
Because we still support u64 and i64 (on top of i32 and u32) we do still have to parse the number ourself first. Then if we determine that the number is a floating point or is outside of the range of i64 and u64 we fallback and parse it as a double. Before JsonParser had ifdefs guarding the double computation, but it just build when we error on ifdef KERNEL so JsonParser is no longer usable in the Kernel. This can be remedied fairly easily but since it is not needed we #error on that for now.
2022-10-23LibC+Tests: Add extra tests for special values for strtoddavidot
2022-10-23AK: Add an exact and fast hex float parsing algorithmdavidot
Similar to decimal floating point parsing the current strtod hex float parsing gives a lot of incorrect results. We can use a similar technique as with decimal parsing however hex floats are much simpler as we don't need to scale with a power of 5. For hex floats we just provide the parse_first_hexfloat API as there is currently no need for a parse_hexfloat_completely API. Again the accepted input for parse_first_hexfloat is very lenient and any validation should be done before calling this method.
2022-10-23AK: Add an exact and fast floating point parsing algorithmdavidot
This is based on the paper by Daniel Lemire called "Number parsing at a Gigabyte per second", currently available at https://arxiv.org/abs/2101.11408 An implementation can be found at https://github.com/fastfloat/fast_float To support both strtod like methods and String::to_double we have two different APIs. The parse_first_floating_point gives back both the result, next character to read and the error/out of range status. Out of range here means we rounded to infinity 0. The other API, parse_floating_point_completely, will return a floating point only if the given character range contains just the floating point and nothing else. This can be much faster as we can skip actually computing the value if we notice we did not parse the whole range. Both of these APIs support a very lenient format to be usable in as many places as possible. Also it does not check for "named" values like "nan", "inf", "NAN" etc. Because this can be different for every usage. For integers and small values this new method is not faster and often even a tiny bit slower than the current strtod implementation. However the strtod implementation is wrong for a lot of values and has a much less predictable running time. For correctness this method was tested against known string -> double datasets from https://github.com/nigeltao/parse-number-fxx-test-data This method gives 100% accuracy. The old strtod gave an incorrect value in over 50% of the numbers tested.
2022-10-23AK: Make truncating UFixedBigInts constexprdavidot
Also add some tests and shift tests while we're at it.
2022-10-20AK: Do not append string bytes as code points when title-casing a stringTimothy Flynn
By appending individual bytes as code points, we were "breaking apart" multi-byte UTF-8 code points. This now behaves the same way as the invert_case() helper in StringUtils.
2022-10-19LibGL: Remove context initialization from testsJelle Raaijmakers
We are either not using these defaults or they are already the `GLContext`'s defaults to begin with.
2022-10-18LibTimeZone+LibJS: Update to TZDB version 2022eTimothy Flynn
https://mm.icann.org/pipermail/tz-announce/2022-October/000074.html This version changes America/Chicago's transtion from LMT to CST from 1883 Nov 18 12:09:24 to 1883 Nov 18 18:00.
2022-10-17LibTimeZone: Default to UTC if parsing the TZ environment variable failsTimothy Flynn
Commit c3fd455 changed LibTimeZone to fall back to the system time zone when we fail to parse the TZ environment variable. This behavior differs from both our LibC and glibc; they abort parsing and default to UTC. This changes LibTimeZone to behave the same way to avoid a very awkward situation where some parts of the codebase thinks the timezone is UTC, and others think the timezone is whatever /etc/timezone indicates.
2022-10-16LibGL: Immediately dereference vertex attribute data in display listsJelle Raaijmakers
According to the spec, pointers to client data need to be dereferenced immediately when adding calls such as `glDrawElements` or `glArrayElement` to a display list. We were trying to support display lists for these calls but since they only invoke _other_ calls that also support display lists, we can simply defer the display list functionality to them. This fixes the rendering of the ClassiCube port by cflip.
2022-10-16Kernel: Use more fine-grained content data block granularity in TmpFSLiav A
Instead of just having a giant KBuffer that is not resizeable easily, we use multiple AnonymousVMObjects in one Vector to store them. The idea is to not have to do giant memcpy or memset each time we need to allocate or de-allocate memory for TmpFS inodes, but instead, we can allocate only the desired block range when trying to write to it. Therefore, it is also possible to have data holes in the inode content in case of skipping an entire set of one data block or more when writing to the inode content, thus, making memory usage much more efficient. To ensure we don't run out of virtual memory range, don't allocate a Region in advance to each TmpFSInode, but instead try to allocate a Region on IO operation, and then use that Region to map the VMObjects in IO loop.
2022-10-14LibSQL: Rewrite the SQL::Value type to be contained within one classTimothy Flynn
Currently, the Value class is essentially a "pImpl" wrapper around the ValueImpl hierarchy of classes. This is a bit difficult to follow and reason about, as methods jump between the Value class and its impl classes. This changes the Variant held by Value to instead store the specified types (String, int, etc.) directly. In doing so, the ValueImpl classes are removed, and all methods are now just concise Variant visitors. As part of this rewrite, support for the "array" type is dropped (or rather, just not re-implemented) as it was unused. If it's needed in the future, support can be re-added. This does retain the ability for non-NULL types to store NULL values (i.e. an empty Optional). I tried dropping this support as well, but it is depended upon by the on-disk storage classes in non-trivial ways.
2022-10-14LibSQL: Remove infallible type conversions from SQL::ValueTimothy Flynn
Force the callers to either know that the type is convertible, or to handle the conversion failure.
2022-10-14Tests+Userland: Implement AARCH64 support for some inline assembly blobsGunnar Beutner
2022-10-14Tests+Userland: Prefer using __builtin_trap() instead of UD2Gunnar Beutner
This way we don't have to hard-code per-architecture instructions.
2022-10-14AK+Toolchain: Make char and wchar_t behave on AARCH64Gunnar Beutner
By default char and wchar_t are unsigned on AARCH64. This fixes a bunch of related compiler errors.
2022-10-14AK+Userland: Stub out code that isn't currently implemented on AARCH64Gunnar Beutner
Even though this almost certainly wouldn't run properly even if we had a working kernel for AARCH64 this at least lets us build all the userland binaries.
2022-10-12test262-runner: Use names for the different exit codesdavidot
These are not used by test-test262 but can be used to quickly distinguish the type of problem if the runner fails when running manually.
2022-10-12test262-runner: Port to Core::Streamdavidot
2022-10-12test-test262: Port to Core::Stream and use TRY moredavidot
The only complication here is that Core::Stream::File is not RefCounted meaning we have to use OwnPtr instead of RefPtr. Unfortunately we cannot propagate errors as some errors must be caught and dealt with as the runner can do anything (like stop at any moment or close pipes).
2022-10-12test-test262: Close the output file stream after writingdavidot
Without this the runner is waiting for new tests which will never come and test-test262 is waiting for output which never comes since the runner is blocked. Also finish off a comment, and make the variables follow serenity style.
2022-10-12LibVideo: Allow the VP9 decoder to decode ultra high resolution videoZaggy1024
Previously, some integer overflows and truncations were causing parsing errors for 4K videos, with those fixed it can fully decode 8K video. This adds a test to ensure that 4K video will continue to be decoded. Note: There seems to be unexpectedly high memory usage while decoding them, causing 8K video to require more than a gigabyte of RAM. (!!!)
2022-10-11LibCompress: Brotli support metadata of skip_length=0Tommy Murphy
The relevant RFC section from https://www.rfc-editor.org/rfc/rfc7932#section-9.2 MSKIPBYTES * 8 bits: MSKIPLEN - 1, where MSKIPLEN is the number of metadata bytes; this field is only present if MSKIPBYTES is positive; otherwise, MSKIPLEN is 0 (if MSKIPBYTES is greater than 1, and the last byte is all zeros, then the stream should be rejected as invalid) So when skip_bytes is zero we need to break and re-align bytes. Added the relevant test case that demonstrates this from: https://github.com/google/brotli/blob/master/tests/testdata/x.compressed
2022-10-11AK+Tests: Correct off-by-one error when right-trimming textSam Atkins
If the entire string you want to right-trim consists of characters you want to remove, we previously would incorrectly leave the first character there. For example: `trim("aaaaa", "a")` would return "a" instead of "". We can't use `i >= 0` in the loop since that would fail to detect underflow, so instead we keep `i` in the range `size .. 1` and then subtract 1 from it when reading the character. Added some trim() tests while I was at it. (And to confirm that this was the issue.)
2022-10-10Everywhere: Replace uses of __serenity__ with AK_OS_SERENITYAndrew Kaster
Now that we have OS macros for essentially every supported OS, let's try to use them everywhere.
2022-10-10Tests: Remove LibRegex benchmark test file that has become staleAndrew Kaster
This test file had #ifdef macros at the top that caused none of the content to be compiled unless a developer manually wanted to run the specific benchmarks within. As such, it has become stale. Remove it for now, if someone wants to restore it in an always-runnable state, we can restore the specific tests it's trying to benchmark.
2022-10-09LibVideo: Add test to ensure that a VP9 WebM file will decodeZaggy1024
This will test decoding of one second of video, to ensure that it can fully decode the entire file.
2022-10-09AK+Tests: Avoid creating invalid code points from malformed UTF-8Ben Wiederhake
Instead of doing anything reasonable, Utf8CodePointIterator returned invalid code points, for example U+123456. However, many callers of this iterator assume that a code point is always at most 0x10FFFF. In fact, this is one of two reasons for the following OSS Fuzz issue: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=49184 This is probably a very old bug. In the particular case of URLParser, AK::is_url_code_point got confused: return /* ... */ || code_point >= 0xA0; If code_point is a "code point" beyond 0x10FFFF, this violates the condition given in the preceding comment, but satisfies the given condition, which eventually causes URLParser to crash. This commit fixes *only* the erroneous UTF-8 decoding, and does not fully resolve OSS-Fuzz#49184.
2022-10-07LibUnicode: Update code point ideographic replacements for Unicode 15Timothy Flynn
2022-10-07LibUnicode: Fix Hangul syllable composition for specific casesmatcool
This fixes `combine_hangul_code_points` which would try to combine a LVT syllable with a trailing consonant, resulting in a wrong character. Also added a test for this specific case.
2022-10-06LibC: Implement `mkstemps()` in stdlib and add a testEWouters
`mkstemps` generates a unique temporary file name from a pattern like `prefixXXXXXXsuffix` where `prefix` and `suffix` can be any string with only characters that are valid in a filename. The second parameter is the length of the suffix. `mkstemp` is `mkstemps` with suffix length 0, so to avoid code duplication it calls `mkstemps`. It is unlikely this has any significant performance impact on SerenityOS. `generate_unique_filename` now takes the suffix length as a `size_t`. The original behavior of this function is preserved when specifying a suffix length of 0. All original uses of this function have been adapted. `mkstemps()` was added because it is required by version 4.6.3 of the ccache port.