summaryrefslogtreecommitdiff
path: root/Tests
AgeCommit message (Collapse)Author
2022-12-06AK+Everywhere: Rename String to DeprecatedStringLinus Groh
We have a new, improved string type coming up in AK (OOM aware, no null state), and while it's going to use UTF-8, the name UTF8String is a mouthful - so let's free up the String name by renaming the existing class. Making the old one have an annoying name will hopefully also help with quick adoption :^)
2022-12-05LibAudio: Switch LoaderPlugin to a more traditional constructor patternTim Schumacher
This now prepares all the needed (fallible) components before actually constructing a LoaderPlugin object, so we are no longer filling them in at an arbitrary later point in time.
2022-12-03Everywhere: Run clang-formatLinus Groh
2022-12-03test262-runner: Add option to enable bytecode optimizationsIdan Horowitz
2022-11-30LibSQL: Partially implement the DELETE commandTimothy Flynn
This implements enough to delete rows filtered by a WHERE clause.
2022-11-30LibSQL+SQLServer: Return a NonnullRefPtr from Database::get_tableTimothy Flynn
Database::get_table currently either returns a RefPtr to an existing table, a nullptr if the table doesn't exist, or an Error if some internal error occured. Change this to return a NonnullRefPtr to an exisiting table, or a SQL::Result with any error, including if the table was not found. Callers can then handle that specific error code if they want. Returning a NonnullRefPtr will enable some further cleanup. This had some fallout of needing to change some other methods' return types from AK::ErrorOr to SQL::Result so that TRY may continue to be used.
2022-11-30LibSQL+SQLServer: Return a NonnullRefPtr from Database::get_schemaTimothy Flynn
Database::get_schema currently either returns a RefPtr to an existing schema, a nullptr if the schema doesn't exist, or an Error if some internal error occured. Change this to return a NonnullRefPtr to an exisiting schema, or a SQL::Result with any error, including if the schema was not found. Callers can then handle that specific error code if they want. Returning a NonnullRefPtr will enable some further cleanup. This had some fallout of needing to change some other methods' return types from AK::ErrorOr to SQL::Result so that TRY may continue to be used.
2022-11-29Tests/Kernel: Add a very simple test for posix_fallocate()Andreas Kling
2022-11-26LibGL: Add some tests for the buffer APIcflip
2022-11-26LibSQL: Fix BTree corruption in `TreeNode::split`Jelle Raaijmakers
After splitting a node, the new node was written to the same pointer as the current node - probably a copy / paste error. This new code requires a `.pointer() -> u32` to exist on the object to be serialized, preventing this issue from happening again. Fixes #15844.
2022-11-26Tests: Replace {'if' => 'ifdef'} AK_OS_EMSCRIPTENAli Mohammad Pur
Our main build doesn't have -Werror-undef, so this went unnoticed.
2022-11-26Everywhere: Add support for compilation under emscriptenAli Mohammad Pur
Co-Authored-By: Andrew Kaster <akaster@serenityos.org>
2022-11-25LibVideo: Read Matroska lazily so that large files can start quicklyZaggy1024
The Demuxer class was changed to return errors for more functions so that all of the underlying reading can be done lazily. Other than that, the demuxer interface is unchanged, and only the underlying reader was modified. The MatroskaDocument class is no more, and MatroskaReader's getter functions replace it. Every MatroskaReader getter beyond the Segment element's position is parsed lazily from the file as needed. This means that all getter functions can return DecoderErrors which must be handled by callers.
2022-11-25LibVideo: Propagate decoder errors in the Matroska ReaderZaggy1024
Matroska::Reader functions now return DecoderErrorOr instead of values being declared Optional. Useful errors can be handled by the users of the parser, similarly to the VP9 decoder. A lot of the error checking in the reader is a lot cleaner thanks to this change, since all reads can be range checked in Streamer::read_octet() now. Most functions for the Streamer class are now also out-of-line in Reader.cpp now instead of residing in the header.
2022-11-25LibVideo: Reorganize demuxer file hierarchy and rename Matroska filesZaggy1024
As new demuxers are added, this will get quite full of files, so it'll be good to have a separate folder for these. To avoid too many chained namespaces, the Containers subdirectory is not also a namespace, but the Matroska folder is for the sake of separating the multiple classes for parsed information entering the Video namespace.
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.