Commit Graph

963 Commits

Author SHA1 Message Date
Timothy Flynn
91db61ae8d LibUnicode: Generate canonical combining class in Unicode data
Will be used by special casing rules.
2021-09-06 15:24:27 +01:00
Ali Mohammad Pur
d20fc922c5 Meta: Correct misuse of ByteBuffer::resize() as grow() in FuzziliJS 2021-09-06 01:53:26 +02:00
Ali Mohammad Pur
97e97bccab Everywhere: Make ByteBuffer::{create_*,copy}() OOM-safe 2021-09-06 01:53:26 +02:00
Tom
918f7cb4a8 Meta: Force legacy xAPIC when using 8 cores or less
This is merely so that we exercise the legacy xAPIC code when we don't
really need x2APIC.
2021-09-04 22:22:58 +02:00
Timothy Flynn
e6a2ab1202 LibUnicode: Generate an implementation of the Add Likely Subtags method 2021-09-04 13:51:40 +01:00
Timothy Flynn
28ae63177e LibUnicode: Generate the entire locale likely-subtags dataset
The amount of aliases in the likely-subtags dataset is quite large, so
this also needed to change the way the data is generated. Otherwise, the
compiler would complain about the size of the generated code.

Previously, a static method was generated that would effectively parse
the dataset into a HashMap of Unicode::LanguageID at runtime. We now
perform that parsing at generation-time, and instead generate an Array
of a structure similar to Unicode::LanguageID (we cannot use the same
structure because it contains String and Optional, which cannot be used
at compile-time).
2021-09-04 13:51:40 +01:00
Liav A
8cb4fcdbd8 Meta: Add q35grub option in run.sh
This option is similar to the qgrub option, but instead of starting a
QEMU PIIX4 machine, it starts a QEMU Q35 machine, booting a grub image
disk within it.
2021-09-04 12:54:00 +02:00
Tom
77953a937d Meta: Add the ability to specify clang with serenity.sh
This enables maintaining gcc and clang builds side-by-side.
2021-09-03 23:12:17 +02:00
Luke Wilde
ed97ee902b LibWeb: Add support for IDL static functions 2021-09-03 23:11:58 +02:00
Luke Wilde
1d8f8ea5b1 LibWeb: Add initial support for AbortController and AbortSignal
The DOM specification says that the primary use case for these is to
give Promises abort semantics. It is also a prerequisite for Fetch,
as it is used to make Fetch abortable.
a
2021-09-02 09:12:17 +02:00
Timothy Flynn
1fbc5dba08 LibUnicode: Generate Unicode locale likely subtag data
CLDR contains a set of likely subtag data where, given a locale, you can
resolve what is the most likely language, script, or territory of that
locale. This data is needed for resolving territory aliases. These
aliases might contain multiple territories, and we need to resolve which
of those territories is most likely correct for a locale.

Note that the likely subtag data is quite huge (a few thousand entries).
As an optimization encouraged by the spec, we only generate the smallest
subset of this data that we actually need (about 150 entries).
2021-09-01 14:14:47 +01:00
Timothy Flynn
9ae7ac4c87 LibUnicode: Generate complex Unicode locale alias matching
Most alias substitutions are "simple", meaning that alias matching is
done by examining a single locale subtag. However, there are a handful
of "complex" aliases where matching is done by examining multiple
subtags. For example, the variant subtag "lojban" causes the locale
"art-lojban" to be canonicalized to "jbo", but only when the language
subtag is "art" (i.e. this should not occur for the locale "en-lojban").

This generates a method to perform complex alias matching.
2021-09-01 14:14:47 +01:00
Timothy Flynn
9b118f1f06 LibUnicode: Generate Unicode locale alias data
CLDR contains a set of aliases for languages, territories, etc. that no
longer are meant to be used (e.g. due to deprecation). For example, the
language "aam" is deprecated and should be canonicalized as "aas".
2021-09-01 14:14:47 +01:00
Timothy Flynn
caf5b6fa6f LibUnicode: Extract cldr-core dataset from CLDR database 2021-09-01 14:14:47 +01:00
Peter Elliott
8d2c04821f Tests: Test LibMarkdown against commonmark test suite
TestCommonmark runs the CommonMark test suite
(https://spec.commonmark.org/0.30/spec.json) against LibMarkdown.
Currently 44/652 tests pass.
2021-08-31 16:53:51 +02:00
Ali Mohammad Pur
1465b11b58 Meta: Implement support for the "unlinkable" Wasm spectest assertion 2021-08-30 22:47:02 +02:00
Ali Mohammad Pur
e93c740df5 Meta: Generate bigints for i64 values in LibWasm test suite files 2021-08-30 22:47:02 +02:00
Andreas Kling
57ac8ff1fd Meta: Update lint-ports.py for the SerenityPorts move 2021-08-30 20:49:37 +02:00
Brian Gianforcaro
619200774b CMake: Add custom target to build only the generated sources
This is needed so all headers and files exist on disk, so that
the sonar cloud analyzer can find them when executing the compilation
commands contained in compile_commands.json, without actually building.

Co-authored-by: Andrew Kaster <akaster@serenityos.org>
2021-08-30 16:44:16 +02:00
Linus Groh
747af8a031 Meta: Remove duplicate valid target check from serenity.sh 2021-08-29 13:50:07 +01:00
Linus Groh
2b70f32876 Meta: Mention aarch64 as a supported TARGET in serenity.sh's help 2021-08-29 13:48:35 +01:00
Nico Weber
ce98aa567c Meta: Don't pass net -device flags in aarch64 buils in run.sh 2021-08-28 21:51:30 +01:00
Nico Weber
ad480505af Meta: Introduce SERENITY_MACHINE variable in run.sh
Set it to all the `-m`, `-display`, `-device` flags for Intel,
and to just "-M raspi3" for aarch64 builds.
2021-08-28 21:51:30 +01:00
Nico Weber
4f3c0fa659 Meta: Disable spice in aarch64 buils in run.sh 2021-08-28 21:51:30 +01:00
Nico Weber
230ea3754d Meta: Run qemu-system-aarch64 in aarch64 builds in run.sh 2021-08-28 21:51:30 +01:00
Nico Weber
00c5e68b11 Meta: Disable kvm for aarch64 in run.sh 2021-08-28 21:51:30 +01:00
Nico Weber
23bc752c5d Meta: Make build-root-filesystem.sh omit libgcc_so.so in aarch64 builds 2021-08-28 21:51:30 +01:00
Andrew Kaster
72de228695 Kernel: Verify interrupts are disabled when interacting with Mutexes
This should help prevent deadlocks where a thread blocks on a Mutex
while interrupts are disabled, and makes it impossible for the holder of
the Mutex to make forward progress because it cannot be scheduled in.

Hide it behind a new debug macro LOCK_IN_CRITICAL_DEBUG for now, because
Ext2FS takes a series of Mutexes from the page fault handler, which
executes with interrupts disabled.
2021-08-28 20:53:38 +02:00
Nico Weber
7052f403c8 Toolchain: Enough to make rebuild-toolchain aarch64 work
The gcc patch might not be completely correct, but at least the
toolchain completes building.
2021-08-28 14:43:07 +01:00
Linus Groh
822566ff1a Meta: Let serenity.sh's TARGET default to SERENITY_ARCH, not i686
This environment variable is already widely used across our build
scripts and tooling, so serenity.sh should respect it as well.
It still uses i686 as the fallback.
2021-08-28 11:20:52 +01:00
Andrew Kaster
834be1a895 Meta: Remove write-only-on-difference script
It's now been replaced with "${CMAKE_PROGRAM}" -E copy_if_different in
all previous usage locations.
2021-08-28 08:44:17 +01:00
Andrew Kaster
63956b36d0 Everywhere: Move all host tools into the Lagom/Tools subdirectory
This allows us to remove all the add_subdirectory calls from the top
level CMakeLists.txt that referred to targets linking LagomCore.

Segregating the host tools and Serenity targets helps us get to a place
where the main Serenity build can simply use a CMake toolchain file
rather than swapping all the compiler/sysroot variables after building
host libraries and tools.
2021-08-28 08:44:17 +01:00
Andrew Kaster
e88761b2b9 Meta+LibUnicode: Move unicode_data helper to Meta/CMake
Moving this helper CMake file to the centralized Meta/CMake folder helps
to get a better grasp on what extra files are required for the build,
and what files are generated.

While we're at it, don't use add_compile_definitions for
ENABLE_UNICODE_DATA, which only needs to be seen by LibUnicode sources.
2021-08-28 08:44:17 +01:00
Andrew Kaster
47471c0ec2 Meta: Prefer SerenityOS_SOURCE_DIR to CMAKE_SOURCE_DIR
By using SerenityOS_SOURCE_DIR we can make custom targets and commands
agnostic to the actual location of the root CMakeLists directory.
All we care about is the root of the SerenityOS project.
2021-08-28 08:44:17 +01:00
Andrew Kaster
20e904d87c Meta: Move code generator helpers to their own CMake helper file
compile_gml, compile_ipc, and generate_state_machine all use host
tools to generate sources for the target build. As part of trying to
organize host tools into a common area, let's move these helper rules to
a common file that we can add other host tools to later. And, keep the
host tool helpers separate from the CMake target helpers for apps and
libraries.
2021-08-28 08:44:17 +01:00
Andrew Kaster
a83847f8bf Meta: Move components CMake helpers to their own file
It's hard to follow how all the functions in the utils.cmake helper file
flow together, so let's move the pieces that are related to each other
into specialized helpers. First up: all the ConfigureComponents related
properties and functions.
2021-08-28 08:44:17 +01:00
kleines Filmröllchen
2dc614127e Meta: Add System32 to the PATH so that reg.exe is always found
On my machine (c), /mnt/c/Windows/System32 is not on the PATH by
default. This causes reg.exe to fail, which is responsible for detecting
the presence of QEMU. By putting this path on the PATH on WSL, it will
always work regardless of the specific PATH configuration, and QEMU is
always detected.
2021-08-27 21:24:25 +01:00
Timothy Flynn
9663525542 CI: Ensure unzip is installed on the builders
The CLDR database comes in a .zip file.
2021-08-26 23:40:23 +02:00
Timothy Flynn
3127454642 CI: Skip Unicode caches for Fuzzer build
There is a bit of a race here between the Fuzzer and non-Fuzzer Lagom
builds. If the Unicode caches are empty, and the Fuzzer build completes
first, then the UCD and CLDR directories will be empty or won't exist.
Skip handling the Unicode caches for this build.
2021-08-26 22:04:09 +01:00
Timothy Flynn
e883792fd4 CI: Cache downloaded Unicode CLDR database 2021-08-26 22:04:09 +01:00
Andreas Kling
c915174563 Userland: Remove IRC Client
The IRC Client application made some sense while our main communication
hub was an IRC channel. Now that we've moved on, IRC is just a random
protocol with no particular relevance to this project.

This also has the benefit of removing one major client of the single-
process Web::InProcessWebView class.
2021-08-24 16:37:28 +02:00
Itamar
6f4324e64e Meta: Add 'copy-src' command to serenity.sh
This command copies the project's source tree to
/home/anon/Source/serenity in the built disk image.

This will be useful for working on serenity inside serenity :^)
2021-08-22 10:28:13 +02:00
Timothy Flynn
ddfd4cced7 CI: Set on-target test timeout to 60 minutes
The on-target pipelines have a timeout of 6 hours to allow time for a
clean toolchain + Serenity build. Tests should time out much sooner than
that though.
2021-08-20 10:34:52 +02:00
Timothy Flynn
25ae1f7f72 CI: Include a timestamp in the Azure ccache key
Caches on Azure are immutable - so if a cache changes, but its key does
not, then the cache is not updated. Include a timestamp in the ccache
key so that we always push an updated cache from the master branch. Then
use a subkey without the timestamp to pull the cache.

We use a similar trick on GitHub Actions.
2021-08-20 10:34:52 +02:00
Brian Gianforcaro
ca9619c750 Meta: Explicitly configure source directory in debug-kernel.sh
Previously debug-kernel.sh wouldn't detect source if you launched the
script from the wrong path. By explicitly setting the name, source will
be loaded by gdb in all situations.
2021-08-19 11:42:20 +02:00
networkException
446bd1e0de README+Meta: Update the screenshot :^) 2021-08-18 14:27:37 +02:00
Martin Åberg
0ed2a03450 Meta: Assume and find GNU du
We want to use use the 'du' option '--apparent-size' which is a
GNU coreutils extension. GNU coreutils is a build dependency so
we know it is available. With this commit we first try to pick up
du as 'gdu', and if that fails, try 'du' instead.
2021-08-18 10:59:50 +02:00
Martin Åberg
0bf867bb9a Meta: Create memory disk before mounting it on FreeBSD
There was previously a case where the build-image-qemu.sh script
decided to mount an existing disk image, but without creating the
memory disk device and recording its /dev file name.

After this commit, We create the memory disk device just before
it is used to mount the disk image.
2021-08-18 10:25:00 +02:00
Andrew Kaster
9bdb44c5d2 CI: Ensure relevant patch files are part of Toolchain cache hash
We were over-hashing for the GNU build on GitHub Actions by including
the LLVM patch as well. The GNU Toolchain doesn't care about our LLVM
patches.

For Azure, fix the inversion of the condition for which jobs check which
Build*.sh script, and add the Toolchain patch files to the cache
hash calculation.
2021-08-18 08:26:38 +02:00
Timothy Flynn
a8f9f160f9 CI: Print on-target debug logs when the tests fail 2021-08-18 08:47:23 +04:30
Timothy Flynn
e3d4778a63 CI: Build Lagom with fuzzing on Azure 2021-08-17 21:06:15 +01:00
Timothy Flynn
3ce6f26924 CI: Build and test SerenityOS with the Clang toolchain on Azure 2021-08-17 13:31:43 +01:00
Timothy Flynn
5eba8c948d CI: Use Azure caching for Lagom build
Adds a compiler cache and a cache for the UCD files.
2021-08-17 13:31:43 +01:00
Timothy Flynn
831f90c9d4 Meta: Semi-automatically detect ccache for Lagom builds
The top-level CMakeLists.txt already automatically detects ccache, but
CI will invoke CMake with Lagom's CMakeLists.txt. Add an option to Lagom
to do the same detection.
2021-08-17 13:31:43 +01:00
Timothy Flynn
27804a6e67 CI: Build and test Lagom (non-fuzzer) on Azure 2021-08-16 18:04:33 +01:00
Brian Gianforcaro
72f348a6cf Meta: Disable printing frame args when debugging the kernel with gdb
The function arguments almost always optimized away, so you never get
much value out of showing these in the default back trace view, it just
adds a bunch of extra stuff that you need to visual wade through.
So lets disable showing them.
2021-08-14 21:18:05 +02:00
Itamar
e57fdb63f8 Tests: Add regression tests for the LibCpp preprocessor
Similarly to the LibCpp parser regression tests, these tests run the
preprocessor on the .cpp test files under
Userland/LibCpp/Tests/preprocessor, and compare the output with existing
.txt ground truth files.
2021-08-14 12:40:55 +02:00
Itamar
a38c330c68 LibCpp: Move parser tests to Userland/Libraries/LibCpp/Tests/parser 2021-08-14 12:40:55 +02:00
sin-ack
1d2bde2403 Meta: Add new-project.sh :^)
This script will instantiate a HackStudio template into a project on the
host. It currently supports all templates used by HackStudio.

To avoid having to maintain compatibility between other shells and the
Serenity shell in the postcreate scripts, we build the Serenity shell
with Lagom and use that to run the script.
2021-08-13 21:12:17 +04:30
Jean-Baptiste Boric
f641cc6470 Meta: Tune default QEMU disk size
Having lots of small files in Base/ may require more inodes in the
ext2 filesystem than the format utility sets aside by default. Let's
make a more educated guess since we have a rough idea of how many
inodes we need by counting files and directories.
2021-08-13 08:04:59 +02:00
Ali Mohammad Pur
f0e7e5bbe8 Meta: Un-escape escaped strings when generating Wasm tests 2021-08-12 21:03:53 +02:00
Ali Mohammad Pur
799471d16f Meta: Don't roundtrip floats for i64/i32 hex literals in wasm tests 2021-08-12 21:03:53 +02:00
sin-ack
a871a2040b Meta: Properly quote some CMake variables in serenity_component
This probably isn't all of them, because I'm no CMake expert. :^)
It does however allow "/bin/false" to build now.
2021-08-12 07:48:50 +02:00
Tom
e3e52a4e61 Meta: Add SERENITY_CPUS environment variable to control number of CPUs 2021-08-09 21:02:23 +02:00
Daniel Bertalan
13e3df41de Meta: Add Clang support to the CMake build scripts 2021-08-08 10:55:36 +02:00
Daniel Bertalan
15e217ea68 Toolchain: Add LLVM patch and script for building it
This contains all the bits and pieces necessary to build a Clang binary
that will correctly compile SerenityOS.

I had some trouble with getting LLVM building with a single command, so
for now, I decided to build each LLVM component in a separate command
invocation. In the future, we can also make the main llvm build step
architecture-independent, but that would come with extra work to make
library and include paths work.

The binutils build invocation and related boilerplate is duplicated
because we only use `objdump` from GNU binutils in the Clang toolchain,
so most features can be disabled.
2021-08-08 10:55:36 +02:00
Gunnar Beutner
2fec891d8e Meta: Allow attaching GDB to the QEMU instance on the WSL2 host 2021-08-08 01:46:41 +02:00
Gunnar Beutner
45f2e9f3cf Meta: Don't use x86_64 QEMU for the i686 kernel
This seemed like a good idea at the time to avoid an unnecessary
dependency on qemu-system-i386. However this makes debugging the
kernel with GDB more difficult because GDB assumes that the QEMU
architectures matches the kernel architecture.
2021-08-08 01:46:41 +02:00
Andrew Kaster
891bc81f30 Meta: Remove syslog.h from clang-format exclusion list
Before Libraries was moved to Userland/Libraries syslog.h had a bunch
of manually aligned defines and array initializations.

Andreas seems to have formatted the file with clang-format as part of
that file move. Since syslog.h is now properly formatted, we don't
need to exclude it from the linter list.
2021-08-07 15:36:51 +02:00
sin-ack
0d468f2282 Kernel: Implement a ISO 9660 filesystem reader :^)
This commit implements the ISO 9660 filesystem as specified in ECMA 119.
Currently, it only supports the base specification and Joliet or Rock
Ridge support is not present. The filesystem will normalize all
filenames to be lowercase (same as Linux).

The filesystem can be mounted directly from a file. Loop devices are
currently not supported by SerenityOS.

Special thanks to Lubrsi for testing on real hardware and providing
profiling help.

Co-Authored-By: Luke <luke.wilde@live.co.uk>
2021-08-07 15:21:58 +02:00
Liav A
02c72de090 Meta: Remove legacy hardware components from Q35 machine
As this is a test machine I use personally to test "modern" hardware
setups, it feels quite comfortable to not care too much about VGA with
this type of machine.
Also, we don't actively use the IDE controller on this machine type, so
let's just remove it :^)
2021-08-07 11:49:07 +02:00
sin-ack
bb609cee7f Meta: Add run-local.sh
This allows one to set their desired parameters for run.sh without the
need to set them in every terminal session or add it to the user account
shell files. If a run-local.sh file exists at the repository root and is
executable, it will be sourced. The file can contain any variables that
are expected to be set in run.sh.
2021-08-07 11:47:07 +02:00
Mandar Kulkarni
566702ffa2 Meta: Fix wrong path for AK Tests in check-ak-test-files.sh 2021-08-05 19:58:55 +02:00
Gunnar Beutner
d9d2287a11 Meta: Detect nested KVM support for WSL2 and use that when available
This allows running QEMU inside WSL2 for hosts which have nested KVM
and WSLg support (e.g. Windows 11).

Running QEMU inside the WSL2 VM is slightly slower than running QEMU
on Windows, probably because of how WSLg handles screen updates.
2021-08-04 21:15:41 +02:00
Gunnar Beutner
723c89af67 Meta: Automatically enable WHPX when possible 2021-08-04 21:15:41 +02:00
Gunnar Beutner
5445155dba Meta: Auto-detect where QEMU is installed on Windows 2021-08-04 21:15:41 +02:00
Liav A
cca1498e09 Meta: Make the Q35 machine more realistic
Although it is nice to test the system without too many devices, in
reality bare metal hardware is far more complex than the default skeleon
that QEMU provides. As a preparation of supporting more devices, we
need to ensure we are capable of at least booting on complex hardware
setups without easily-observable problems. Later on, this can be the
foundations of testing new drivers :^)
2021-08-03 21:08:01 +02:00
Gunnar Beutner
31655c9486 Meta: Prefer to use the 64-bit QEMU binary if that's available
Some users might not have qemu-system-i386 installed.
2021-08-03 13:59:57 +01:00
Gunnar Beutner
b082488e94 Meta: Prefer to use -machine pcspk-audiodev for QEMU >=5.1
This gets rid of the following warning message from QEMU on startup:

qemu-system-i386: warning: '-soundhw pcspk' is deprecated, please set a
backend using '-machine pcspk-audiodev=<name>' instead

Fixes #4093.
2021-08-03 13:59:57 +01:00
Gunnar Beutner
74af43ed97 Meta: Improve WSL detection for the run.sh script
For users who use a custom kernel with WSL our previous method of
detecting WSL doesn't work. This new check instead detects WSL by
checking if the wslpath utility is available.
2021-08-02 11:47:29 +01:00
Andrew Kaster
40b0767d88 Meta: Add BUILD_SHARED_LIBS option for Lagom builds
This standard CMake option controls whether add_library() calls will
use STATIC or SHARED by default. The flag is set to on by default
since that's what we want for normal CI jobs and local builds and the
test262 runner, but disabled for oss-fuzz builds.

This should finally fix the oss-fuzz build after it was broken in #9017

oss-fuzz un-breakage was verified by running the following commands in
the oss-fuzz repo:

python infra/helper.py build_image serenity
python infra/helper.py build_fuzzers --sanitizer address --engine afl \
    --architecture x86_64 serenity /path/to/local/checkout/Meta/Lagom
python infra/helper.py check_build --sanitizer address --engine afl \
    --architecture x86_64 serenity
2021-08-02 09:05:28 +02:00
x-yl
8e8b1c8333 Meta: Explicitly specify the disk format in the QEMU options
Otherwise we're getting this warning:

WARNING: Image format was not specified for '_disk_image' and probing
         guessed raw. Automatically detecting the format is dangerous
         for raw images, write operations on block 0 will be restricted.
         Specify the 'raw' format explicitly to remove the restrictions.
2021-08-02 00:35:22 +02:00
Gunnar Beutner
c73c40a21d Meta: Fix compatibility with QEMU 5.x
QEMU 5 doesn't support -machine pcspk-audiodev so we need to fall back
to using -soundhw for that.
2021-08-02 00:35:22 +02:00
Sam Atkins
e54531244f LibWeb: Define proper debug symbols for CSS Parser and Tokenizer
You can now turn debug logging for them on using `CSS_PARSER_DEBUG` and
`CSS_TOKENIZER_DEBUG`.
2021-07-31 00:18:11 +02:00
Gunnar Beutner
8b2e76b838 Meta: Make audiodev detection more robust
This fixes audio on Windows as well as Linux systems which don't have
SDL.

Fixes #8903.
2021-07-30 23:51:26 +02:00
Gunnar Beutner
dff8b3d2d9 Meta: Make rsync a hard dependency and remove the fallback code
Previously we'd fall back to using cp if rsync wasn't available. Not
only is this considerably slower it also breaks when some of the files
in the target directory are symlinks because cp tries to dereference
them.

Fixes #8672.
2021-07-30 23:50:29 +02:00
Timothy Flynn
d485cf29d7 LibRegex+LibUnicode: Begin implementing Unicode property escapes
This supports some binary property matching. It does not support any
properties not yet parsed by LibUnicode, nor does it support value
matching (such as Script_Extensions=Latin).
2021-07-30 21:26:31 +01:00
Brian Gianforcaro
a4dc1eb330 Lagom: Fix oss-fuzz build error due to CMake typo
The OSS-Fuzz build was failing with the following error:

 /usr/bin/ld: cannot find -l{}
2021-07-30 20:28:59 +01:00
Andrew Kaster
32d076ef54 Lagom: Add proper install rules
Create the proper export files to allow Lagom to be a well-behaved
ExternalProject, based on the example project from the cmake-init
project generator here:

https://github.com/friendlyanon/cmake-init-shared-static
2021-07-29 21:46:25 +01:00
Linus Groh
7392a73066 Lagom: Exclude GMLAutocompleteProvider.cpp from GML library sources 2021-07-29 21:46:25 +01:00
Andrew Kaster
b6e5117f65 Lagom: Change to shared library build for all Lagom code
Split the Lagom build into shared libraries to match the Serenity build.

This reduces the cognitive load when trying to edit the Lagom CMakeLists
significantly. It also reduces the amount of source files that must be
compiled to run each test or host program significantly.

Also re-organize all the build rules into sections. And reorganize the
CMakeLists file in general.
2021-07-29 21:46:25 +01:00
Andrew Kaster
de2bf3f333 Meta/LibTest: Build object libraries for test main files
By using the power of object libraries and $<TARGET_OBJECTS> we can make
sure to only build TestMain.cpp and JavaScriptTestRunnerMain.cpp once.

Previously we built these cpp files into object files once for every
single test executable. This change reduces the number of total compile
jobs in a Serenity target build by around 100.
2021-07-29 21:46:25 +01:00
Andrew Kaster
af9be6e093 LibTTF/LibGfx: Remove circular dependency by merging LibTTF into LibGfx
LibTTF has a concrete dependency on LibGfx for things like Gfx::Bitmap,
and LibGfx has a concrete dependency in the TTF::Font class in
Gfx::FontDatabase. This circular dependency works fine for Serenity and
Lagom Linux builds of the two libraries. It also works fine for static
library builds on Lagom macOS builds.

However, future changes will make Lagom use shared libraries, and
circular library dependencies are not tolerated in macOS.
2021-07-29 21:46:25 +01:00
Andreas Kling
b3d27c2340 LibGUI: Add GUI_HOVER_DEBUG runtime debugging flag (environment)
You can now see the outline of GUI widgets when hovering them.
For example:

    $ export GUI_HOVER_DEBUG=1
    $ FileManager

Then move the mouse around in the file manager. :^)
2021-07-28 01:01:02 +02:00
Karol Kosek
220dd28b02 Meta: Ignore everything after the git cut line in a lint-commit.sh hook
I have set up a commit.verbose variable in my git config,
which shows the patch diff on bottom of the commit message.

Unfortunately the character limit was also applied to the diff,
which meant that I got a false-positive lint error almost every time.
2021-07-27 22:35:49 +01:00
Idan Horowitz
350fb0e3db Meta: Bring lint-commit.sh up to date with the CI commit linter
This was missing 2 of the recently added checks. Also added a reminder
in the CI linter to update the Meta (commit hook) version.
2021-07-27 20:41:49 +01:00
x-yl
4bdd62939a Meta: Set -audiodev explictly
Unfortunately seems like QEMU tries to use SPICE for audio so we need to
explicitly set -audiodev to use either SDL or coreaudio (depending on
platorm)
2021-07-27 19:15:37 +02:00
Gunnar Beutner
57417a3d6e Kernel: Support loading the kernel at almost arbitrary virtual addresses
This enables further work on implementing KASLR by adding relocation
support to the pre-kernel and updating the kernel to be less dependent
on specific virtual memory layouts.
2021-07-27 13:15:16 +02:00
Timothy Flynn
98d8274040 Meta: Add LibUnicode (and its tests) to Lagom
This is primarily to allow using LibUnicode within LibJS and its REPL.

Note: this seems to be the first time that a Lagom dependency requires
generated source files. For this to work, some of Lagom's CMakeLists.txt
commands needed to be re-organized to include the CMake files that fetch
and parse UnicodeData.txt. The paths required to invoke the generator
also differ depending on what is currently building (SerenityOS vs.
Lagom as part of the Serenity build vs. a standalone Lagom build).
2021-07-26 17:03:55 +01:00
Ali Mohammad Pur
466e2a2fb7 Meta: Don't reboot on triple-fault in CI mode
Instead, just make QEMU quit immediately.
2021-07-26 02:29:25 +04:30
Thomas Wagenveld
2002b7e2e3 Meta/run.sh: Allow for overriding of QEMU ethernet device type
You can set the SERENITY_ETHERNET_DEVICE_TYPE environment variable to
pick another device type (i.e. ne2k_pci). Defaults to e1000 as before.
2021-07-24 21:28:22 +02:00
Luke
7e7c65abb6 Lagom/Fuzzers: Add fuzzer for the quoted printable decoder 2021-07-24 20:11:28 +04:30
Gunnar Beutner
cc0914ae58 Meta: Add Homebrew paths for macOS on M1 to the PATH env variable 2021-07-24 14:04:13 +02:00
Andreas Kling
3f9e018d9a CrashDaemon: Remove BACKTRACE_DEBUG debugging code
This thing seems to work fine, no need to hang on to old debug code.
2021-07-22 23:34:33 +02:00
Gunnar Beutner
9031ed0b84 Meta: Add a new qextlinux target for the run.sh script
This allows testing the extlinux image with QEMU.
2021-07-20 15:12:19 +02:00
Gunnar Beutner
696e15fcd8 Meta: Update extlinux config for the recent prekernel changes 2021-07-20 15:12:19 +02:00
Gunnar Beutner
6a45ebe282 Meta: Fix syslinux detection on Arch Linux 2021-07-20 15:12:19 +02:00
Gunnar Beutner
e3b7ae0c77 Meta: Remove unused bootloader_test target
Due to other changes this is now just a copy of the q35 target.
2021-07-18 22:08:03 +02:00
Gunnar Beutner
61a8f3e81a Kernel: Fix GRUB config by specifying the correct file name 2021-07-18 22:08:03 +02:00
Gunnar Beutner
7e94b090fe Kernel: Introduce basic pre-kernel environment
This implements a simple bootloader that is capable of loading ELF64
kernel images. It does this by using QEMU/GRUB to load the kernel image
from disk and pass it to our bootloader as a Multiboot module.

The bootloader then parses the ELF image and sets it up appropriately.
The kernel's entry point is a C++ function with architecture-native
code.

Co-authored-by: Liav A <liavalb@gmail.com>
2021-07-18 17:31:13 +02:00
Gunnar Beutner
98f8ecd9d2 Kernel: Split debug symbols into a separate file
This speeds up the boot process considerably when specifying the kernel
image via -initrd.
2021-07-18 17:31:13 +02:00
Riyyi
5d1676b05a Meta: Do not warn user about too modern clang-format
To prevent warnings for users of varying distributions, do not warn the
user if the clang-version is higher than the expected version.
2021-07-15 09:27:44 +02:00
Sam Atkins
fa7a6fbedd Meta: Fix SPICE detection in run.sh
The previous fix did not work for me, but this does. :^)

Credit goes to @X-yl for actually figuring it out.
2021-07-14 21:17:56 +02:00
x-yl
410eb9e9ff Meta: Don't use SPICE if QEMU doesn't support it
I do seem to have a tendency for breaking everyone's builds :/
2021-07-14 17:17:06 +02:00
x-yl
6b68f16f2c Meta: Change QEMU options in run.sh to use SPICE
If QEMU has the qemu_vdagent chardev (should be present in QEMU 6.1)
then we use that as the SPICE client.

If qemu_vdagent is not present, no SPICE client will be launched by
default because it makes the display a bit choppy.

Set SERENITY_SPICE to override the default behavior and use your default
SPICE client.
2021-07-14 12:33:07 +02:00
Liav A
11fe38346c Meta: Remove options of explicit command line runners in run script
Let's remove the qcmd and q35_cmd options and instead have a simple
"q35" run option. Specifiying the kernel command line was a neat trick
I personally used for many debug sessions, but it seems better to stick
to setting it internally in the kernel or modifying the shell
SERENITY_KERNEL_CMDLINE environment variable to do this.
2021-07-13 23:24:16 +02:00
Liav A
c92c944356 Meta: Tweak qemu run script to use pcie-root-ports
With this change, we use 6 PCIe root ports in the Q35 machine, and plug
the bochs-display device into one of those PCIe ports.
We plug the bochs-display as function 0 of that device, because
otherwise SeaBIOS and also the kernel will not detect its presence.
2021-07-13 23:24:16 +02:00
Idan Horowitz
f09e361eef CI: Disallow spaces just before the separating colon in commit titles 2021-07-13 19:56:14 +01:00
Gunnar Beutner
77795b2c8f Meta: Make sure files are installed with the right UID and GID
Unfortunately we can't just use --chown everywhere because only rsync
version 3.1 and newer support it and the default rsync on macOS is
2.6.9.

Fixes #8711.
2021-07-13 13:30:29 +02:00
Gunnar Beutner
7347c20fe6 Meta: Fix QEMU detection for WSL2 if QEMU isn't installed on the C drive 2021-07-13 12:57:21 +02:00
Luke
448e8c6f45 Lagom/Fuzzers: Add fuzzer for FLAC loader 2021-07-13 01:15:46 +02:00
Luke
93340685ed Lagom/Fuzzers: Add fuzzer for POSIX basic regex parser 2021-07-13 01:34:22 +04:30
Andrew Kaster
8823548a4e Meta: Skip WebAssembly loop test generation
This test hangs and times out.
2021-07-12 18:42:45 +04:30
Andrew Kaster
1455604b13 AK+Meta: Remove unused AUTOCOMPLETE_DEBUG flag 2021-07-12 12:26:52 +02:00
Gunnar Beutner
7d38057705 Meta: Only use -display sdl for multiple screens when it's available 2021-07-11 23:27:43 +02:00
Gunnar Beutner
bc5d50e78b Meta: Use gl=off for QEMU by default 2021-07-11 22:07:47 +02:00
Gunnar Beutner
8e4978fe04 Meta: Use the SDL backend for QEMU on Windows 2021-07-11 22:07:47 +02:00
x-yl
642aa65310 Meta: Only try to use SDL when there are multiple displays
SDL brings with it an annoying issue whereby trying to resize the window
before Serenity starts up prevents it from automatically resizing to fit
the screen.

This patch makes the previous behavior (i.e using the GTK backend) the
default unless SERENITY_SCREENS is greater than 1.
2021-07-11 21:16:56 +02:00
Gunnar Beutner
baf40ad96d Documentation+Meta: Automatically add disable_virtio on Windows 2021-07-10 23:24:45 +02:00
Gunnar Beutner
cc87bf46c1 Documentation+Meta: Automatically set vmx=off on Windows 2021-07-10 23:24:45 +02:00
Gunnar Beutner
ee7e9f05a8 Meta: Automatically use WSL paths on Windows 2021-07-10 23:24:45 +02:00
Gunnar Beutner
9026dbbfd6 Documentation: Reorganize the build documentation 2021-07-10 23:24:45 +02:00
Gunnar Beutner
9780cdfb33 Meta: Automatically pick an appropriate GCC binary 2021-07-10 23:24:45 +02:00
Jan de Visser
99dc3469e8 Lagom: Exclude LibSQL/SQLClient.cpp and the sql utility from Lagom
Lagom doesn't seem to like IPC services, and sql needs SQLClient.
2021-07-08 17:55:59 +04:30
Jan de Visser
a034774e3a LibSQL+SQLServer: Build SQLServer system service
This patch introduces the SQLServer system server. This service is
supposed to be the only process/application talking to database storage.
This makes things like locking and caching more reliable, easier to
implement, and more efficient.

In LibSQL we added a client component that does the ugly IPC nitty-
gritty for you. All that's needed is setting a number of event handler
lambdas and you can connect to databases and execute statements on them.

Applications that wish to use this SQLClient class obviously need to
link LibSQL and LibIPC.
2021-07-08 17:55:59 +04:30
Max Wipfli
2d71eaadcd Meta: Add the ConfigureComponents utility
This adds a utility program which is essentially a command generator for
CMake. It reads the 'components.ini' file generated by CMake in the
build directory, prompts the user to select a build type and optionally
customize it, generates and runs a CMake command as well as 'ninja
clean' and 'rm -rf Root', which are needed to properly remove system
components.

The program uses whiptail(1) for user interaction.
2021-07-06 21:54:51 +02:00
Ali Mohammad Pur
f5d4e26ff7 Meta+LibWasm: Correctly parse the invokee name in toplevel invokes 2021-07-06 17:55:00 +04:30
Ali Mohammad Pur
963f5e69e0 Meta+LibWasm: Generate calls to functions when they don't have results 2021-07-06 17:55:00 +04:30
Idan Horowitz
53f70e5208 LibJS: Remove the default length & attributes from define_native_*
These are usually incorrect, and people sometimes forget to add the
correct values as a result of them being optional, so they should just
be specified explicitly.
2021-07-06 14:20:30 +01:00
Idan Horowitz
a6b8291a9b LibJS: Add define_direct_property and remove the define_property helper
This removes all usages of the non-standard define_property helper
method and replaces all it's usages with the specification required
alternative or with define_direct_property where appropriate.
2021-07-06 14:20:30 +01:00
Gunnar Beutner
5c3f781031 Meta: Fix building Lagom on Linux 2021-07-06 02:10:37 +02:00
Gunnar Beutner
01db5205ab LibThreading: Fix building the library on macOS 2021-07-06 00:06:32 +02:00
Linus Groh
7efc52c3d3 Meta: Remove the LibJS OBJECT_DEBUG debug macro
I didn't add any debug logging to the object rewrite, so this is now
unused. It's much more correct though, so we can get away with adding
ad-hoc logging, should that ever be necessary :^)

Side note: this should have a prefix, i.e. JS_OBJECT_DEBUG. The previous
name is too generic.
2021-07-04 22:07:36 +01:00
Andreas Kling
49d0b9e808 LibTTF: Memory map TTF fonts instead of reading them into heap memory
All GUI applications currently load all TTF fonts on startup
(to populate the Gfx::FontDatabase. This could probably be smarter.)

Before this patch, everyone would open the files and read them into
heap-allocated storage. Now we simply mmap() them instead. :^)
2021-07-04 21:34:26 +02:00
Andreas Kling
560109bd42 LibTTF: Make TTF::Font loading API return error strings 2021-07-04 21:34:26 +02:00
Gunnar Beutner
de152832be Meta: Add missing quotes in Meta/run.sh 2021-07-03 20:08:54 +02:00
Idan Horowitz
0e35c50da3 Meta: Use virtualization acceleration if available in CI runs 2021-07-03 18:32:39 +01:00
Liav A
70278d57ba Meta: Add a few more graphics devices to the Q35 for testing purposes 2021-07-03 16:28:49 +02:00
Gunnar Beutner
d0c4524234 Meta: Provide better instructions when QEMU is not installed or too old 2021-07-03 12:06:20 +02:00
Gunnar Beutner
0ec1077bcb Meta: Prefer to use the QEMU binaries from the toolchain directory 2021-07-03 12:06:20 +02:00
Liav A
acd2604a31 Revert "Revert "Revert "Kernel: Fix PCI layout of i440fx QEMU machine"""
This reverts commit a808fff2ec.

I highly suspect the reason it was not working before was fixed in
017c5fc7d9, so the SB16 DMA can work even
if we initialize another E1000 network adapter.
2021-07-02 13:16:12 +02:00
Idan Horowitz
3265141286 Meta: Make serenity.sh pass the SERENITY_ARCH cmake argument for x86_64
This is required as our CMake config defaults to i686 if not overriden
manually via the SERENITY_ARCH argument.
2021-07-01 18:08:16 +02:00
Gal Horowitz
d0c7a48186 Meta: Add environment variable for disabling qemu's gdb socket
When running QEMU on windows, the `-s` does not work, and causes QEMU to
crash, you can now use the environment variable to disable that option.
2021-06-30 18:49:04 +01:00
Gal Horowitz
eed6adb6fc Meta: Do not use gl=on if building in WSL2
The existing check only detects WSL1, this adds a new check which also
detects WSL2.
2021-06-30 18:49:04 +01:00
Liav A
3d89938c4a SystemServer+Meta: Use the new SysFS
We make SystemServer to mount the new SysFS in /sys.
2021-06-29 20:53:59 +02:00
Gunnar Beutner
449d34a154 Meta: Change default GDB layout
This adds a TUI window that displays disassembly/source code which
I've found quite useful.
2021-06-29 20:03:36 +02:00
Gunnar Beutner
0cb937416b Meta: Install 64-bit libgcc_s.so for x86_64 targets 2021-06-28 22:29:28 +02:00
Sahan Fernando
16eb0803fc Meta: Choose the QEMU display backend based on whats available 2021-06-28 07:01:11 +04:30
stelar7
1f33c517df Meta: Do not use gl=on if building in WSL 2021-06-27 15:48:08 +02:00
Sahan Fernando
44174a44bd Meta: Use virtio-vga instead of virtio-gpu if using multiple monitors 2021-06-26 18:45:35 +02:00
Tom
8fe52b8306 Meta: Force relative mouse coordinates with multiple screens
QEMU appears to always relay absolute mouse coordinates relative to the
screen that the mouse is pointed to, without any way for us to know
what screen it was. So, when dealing with multiple displays force using
relative coordinates only.
2021-06-25 23:54:37 +02:00
Tom
3d5340d033 Meta: Add SERENITY_SCREENS environment variable
This allows specifying how many screens we should use. This also then
only enables virtio-gpu if more than one display is requested.

This also adds an environment variable SERENITY_QEMU_DISPLAY_BACKEND
which allows overriding the default qemu display backend, as it may
not be available.
2021-06-25 22:20:55 +02:00
Sahan Fernando
b9ad6058aa Kernel: Add VirtIOGPU graphics device 2021-06-25 19:26:30 +02:00
kleines Filmröllchen
988763c0ef Toolchain: Add the AFLACLOADER_DEBUG macro
This enables FLAC debugging output, which is used
with the new FLAC loader introduced in later commits.
2021-06-25 20:48:14 +04:30
Gunnar Beutner
f17b4e561f Meta: Increase RAM amount for Bochs
Booting with 128 MB of RAM is kind of tough.
2021-06-25 15:19:09 +02:00
Gunnar Beutner
c9747a3236 Kernel: Build the x86_64 kernel as an ELF32 executable
Multiboot only supports ELF32 executables. This changes the build
process to build an ELF32 executable which has a 32-bit entry point,
but consists of mostly 64-bit code.
2021-06-25 15:19:09 +02:00
Gunnar Beutner
1979c7d185 Meta: Run 64-bit kernels with qemu-system-x86_64 2021-06-25 15:19:09 +02:00
Jan de Visser
4198f7e1af LibSQL: Move Lexer and Parser machinery to AST directory
The SQL engine is expected to be a fairly sizeable piece of software.
Therefore we're starting to restructure the codebase for growth.
2021-06-24 00:36:53 +02:00
coderdreams
9ffb3e7e30 LibCore: Add unit test for File::read_line 2021-06-22 18:54:40 +04:30
Ali Mohammad Pur
79d4913f76 LibWasm: Generate all spec tests, even ones that aren't valid modules
`wasm-as` will do some semantic analysis on the modules, which is not
something we're looking for here.
Instead, use `wat2wasm` to generate the exact module.
2021-06-22 00:26:25 +04:30
Ali Mohammad Pur
9c5d38b7db Meta+LibWasm: Add support for module linking tests
This commit makes the linking tests in the wasm spec test run.
2021-06-22 00:26:25 +04:30
Peter Bocan
4d5ffd364a LibCrypto+LibTLS: Split and move test suite into Tests directory
This change splits test-crypto.cpp from Userland into separate test
suites located in Tests/ directory.
2021-06-19 19:05:36 +04:30
Itamar
03ef2a479a LibCoreDump: Include source locations of inlined functions in backtrace 2021-06-19 14:51:18 +02:00
Luke
f29036dc98 Lagom/Fuzzers: Add fuzzers for all current hashing functions
Namely MD5, SHA1, SHA256, SHA384 and SHA512.
2021-06-18 21:44:56 +01:00
Sam Atkins
0e680cb17a Meta: Ensure long messages fit in commit tweet
Abbreviating the commit message to 240 characters was not always enough.
As a bonus, we now add an ellipsis to abbreviated messages.
2021-06-18 13:34:17 +01:00
sin-ack
e2215cc0e1 Lagom: Add an install target
This is used by libjs-test262-runner to be able to copy the libraries
within its own build directory in order to link with them.
2021-06-17 21:20:24 +01:00
Gunnar Beutner
6e094b8dbe Meta: Increase additional space for disk images
Previously we'd add 100MB on top of what du returned for the Root
directory. This increases that to 500MB.
2021-06-17 11:03:51 +02:00
Gunnar Beutner
d7a03397af Meta: Allow building images without most utilities
Previously the build script assumed that certain utilities were always
available.
2021-06-17 11:03:51 +02:00
Gunnar Beutner
0dd03413d6 Meta: Add support for declaring components
Components are a group of build targets that can be built and installed
separately. Whether a component should be built can be configured with
CMake arguments: -DBUILD_<NAME>=ON|OFF, where <NAME> is the name of the
component (in all caps).

Components can be marked as REQUIRED if they're necessary for a
minimally functional base system or they can be marked as RECOMMENDED
if they're not strictly necessary but are useful for most users.

A component can have an optional description which isn't used by the
build system but may be useful for a configuration UI.

Components specify the TARGETS which should be built when the component
is enabled. They can also specify other components which they depend on
(with DEPENDS).

This also adds the BUILD_EVERYTHING CMake variable which lets the user
build all optional components. For now this defaults to ON to make the
transition to the components-based build system easier.

The list of components is exported as an INI file in the build directory
(e.g. Build/i686/components.ini).

Fixes #8048.
2021-06-17 11:03:51 +02:00
Brian Gianforcaro
f0fbaa00a4 Meta: Remove gdb pretty printer for AK::InlineLinkedList 2021-06-16 10:40:01 +02:00
Ali Mohammad Pur
1414c7b049 LibJS: Add a basic pass manager and add some basic passes
This commit adds a bunch of passes, the most interesting of which is a
pass that merges blocks together, and a pass that places blocks that
flow into each other next to each other, and a very simply pass that
removes duplicate basic blocks.
Note that this does not remove the jump at the end of each block in that
pass to avoid scope creep in the passes.
2021-06-15 22:06:33 +04:30
networkException
472721b774 Everywhere: Use new discord invite url :^)
Replaces all instances of the previous discord invite link
with a shiny new vanity url.
2021-06-14 22:41:37 +01:00
Apoorv Mishra
f32ab73acc
Meta: Fix QEMU version check in run.sh
The QEMU version check in `Meta/run.sh` fails on macOS because the BSD
version of `grep` does not support the `-P` option. Using `sed` instead.
2021-06-13 12:05:48 +01:00
Jesse Buhagiar
06f1edb516 USB: Further Implement USB Structures
These are the actual structures that allow USB to work (i.e the ones
actually defined in the specification). This should provide us enough
of a baseline implementation that we can build on to support
different types of USB device.
2021-06-12 18:17:25 +04:30
x-yl
ac712b07f9 Meta: Fuzz the LibIMAP Parser 2021-06-11 23:58:28 +04:30
Gunnar Beutner
87b1da4441 Revert "Meta: Use Intel 82574 instead of Intel 82540 in the run script"
This reverts commit 84b2dc0fb8.
2021-06-11 11:32:19 +02:00
Idan Horowitz
a898e01d4d Kernel: Add driver for RTL8168 & RTL8111 NICs
These are pretty common on older LGA1366 & LGA1150 motherboards.

NOTE: Since the registers datasheets for all versions of the chip
besides versions 1 - 3  are still under NDAs i had to collect
several "magical vendor constants" from the *BSD driver and the
linux driver that i was not able to name verbosely, and as such
these are labeled with the comment "vendor magic values".
2021-06-10 21:54:51 +02:00
Liav A
84b2dc0fb8 Meta: Use Intel 82574 instead of Intel 82540 in the run script 2021-06-09 22:44:09 +04:30
Liav A
c6480a0426 Kernel/Net: Support Intel 82574 adapter
We call it E1000E, because the layout for these cards is somewhat not
the same like E1000 supported cards.

Also, this card supports advanced features that are not supported on
8254x cards.
2021-06-09 22:44:09 +04:30
Apoorv Mishra
5d57384bc4 Meta: Check installed QEMU version
`ninja install` fails with a clueless error message if the installed
QEMU version is less than 5.0.
2021-06-09 18:53:32 +02:00
Andreas Kling
675b0aee24 Websites: Some updates for the serenityos.org front page
- Add link to the Discord server
- Remove reference to Freenode IRC channel since it's no longer used
- Add sponsorship links for Linus :^)
2021-06-08 10:56:52 +02:00
Andreas Kling
7cbe4daa7c LibJS: Move bytecode debug spam behind JS_BYTECODE_DEBUG :^) 2021-06-07 18:11:59 +02:00
FalseHonesty
403bb07443 LibVideo: Scaffold LibVideo and implement simplistic Matroska parser
This commit initializes the LibVideo library and implements parsing
basic Matroska container files. Currently, it will only parse audio
and video tracks.
2021-06-06 17:47:00 +02:00
Ali Mohammad Pur
51c2c69357 AK+Everywhere: Disallow constructing Functions from incompatible types
Previously, AK::Function would accept _any_ callable type, and try to
call it when called, first with the given set of arguments, then with
zero arguments, and if all of those failed, it would simply not call the
function and **return a value-constructed Out type**.
This lead to many, many, many hard to debug situations when someone
forgot a `const` in their lambda argument types, and many cases of
people taking zero arguments in their lambdas to ignore them.
This commit reworks the Function interface to not include any such
surprising behaviour, if your function instance is not callable with
the declared argument set of the Function, it can simply not be
assigned to that Function instance, end of story.
2021-06-06 00:27:30 +04:30
Ali Mohammad Pur
d7ba15371b Meta: Don't make wasm tests pass when they cannot read a module
Instead, just let them be treated as failing their respective test.
2021-06-04 16:07:42 +04:30
NonStandardModel
c4c577b2bf Meta: Sort debug macros alphabetically 2021-06-03 18:44:45 +01:00
Ali Mohammad Pur
6b5d1eedcb Meta: Make the wasm test generator cast numbers to i32 when needed
Otherwise the sign would be out of whack
2021-06-02 16:09:16 +04:30
Ali Mohammad Pur
7fb458b7c9 Meta: Generate failing tests for unsupported assertions in wasm tests
Let's not ignore a test just because our test generator doesn't
understand it, assume the worst and generate a failing test case
instead.
2021-06-02 16:09:16 +04:30
Linus Groh
21a62fe836 Meta: Remove duplicated ensure_toolchain from serenity.sh 2021-06-02 00:34:41 +01:00
Jelle Raaijmakers
468bb54677 Meta: Make serenity.sh invoke cmake when build.ninja is missing 2021-06-01 11:33:56 +01:00
Max Wipfli
0d0ed4962f AK: Add a new, spec-compliant URLParser
This adds a new URL parser, which aims to be compliant with the URL
specification (https://url.spec.whatwg.org/). It also contains a
rudimentary data URL parser.
2021-06-01 09:28:05 +02:00
Nick Miller
10ba6f254c Kernel: Rename instances of IO port 0xe9 to BOCHS_DEBUG_PORT 2021-05-31 19:06:13 +01:00
Luke
3bc2527ce7 Lagom/Fuzzers: Add SQL parser fuzzer 2021-05-31 17:07:52 +04:30
Brian Gianforcaro
26cb64573c CMake: Hide KMALLOC_VERIFY_NO_SPINLOCK_HELD so folks don't find it
Since I introduced this functionality there has been a steady stream of
people building with `ALL_THE_DEBUG_MACROS` and trying to boot the
system, and immediately hitting this assert. I have no idea why people
try to build with all the debugging enabled, but I'm tired of seeing the
bug reports about asserts we know are going to happen at this point.

So I'm hiding this value under the new ENABLE_ALL_DEBUG_FACILITIES flag
instead. This is only set by CI, and hopefully no-one will try to build
with this thing (It's documented as not recommended).

Fixes: #7527
2021-05-31 11:30:47 +01:00
Gunnar Beutner
5f18cf75c5 AK: Replace ByteBuffer::grow with resize()/ensure_capacity()
Previously ByteBuffer::grow() behaved like Vector<T>::resize().
However the function name was somewhat ambiguous - and so this patch
updates ByteBuffer to behave more like Vector<T> by replacing grow()
with resize() and adding an ensure_capacity() method.

This also lets the user change the buffer's capacity without affecting
the size which was not previously possible.

Additionally this patch makes the capacity() method public (again).
2021-05-31 14:49:00 +04:30
Andreas Kling
33f2eeea4a pls: Drastically simplify this program
Since this program is setuid-root, it should be as simple as possible.

To that end, remove `/etc/plsusers` and use filesystem permissions to
achieve the same thing. `/bin/pls` is now only executable by `root` or
members of the `wheel` group.

Also remove all the logic that went to great lengths to `unveil()` a
minimal set of filesystem paths that may be used for the command.
The complexity-to-benefit ratio did not seem justified, and I think
we're better off keeping this simple.

Finally, remove pledge promises the moment they are no longer needed.
2021-05-30 23:09:37 +02:00
Edwin Hoksberg
e68780e1ad WebServer: Put dbgln's behind WEBSERVER_DEBUG
These dbgln's caused excessive load in the WebServer process,
accounting for ~67% of the processing time when serving a webpage
with a bunch of resources like serenityos.org/happy/2nd/.
2021-05-30 17:41:56 +01:00
Ben Wiederhake
774107f37c Fuzz+LibGfx: When fuzzing GIFLoader, try to load all frames 2021-05-30 14:42:34 +01:00
Jesse Buhagiar
d44e2c9ad9 Userland: Check sudoers file perms and owner in pls
As per comment found in #6319 by @bcoles, `pls` should check the
permissions and owner of the sudoers file to ensure that it hasn't
been compromised.
2021-05-29 22:33:12 +04:30
Jesse Buhagiar
82b48d867d Userland: Implement pls, a sudo clone 2021-05-29 22:33:12 +04:30
Andrew Kaster
3ece67d62d Meta/CI: Remove IRC notifications
With the increased volume of PRs being opened and merged lately,
multiple people have complained that the IRC is absolutely flooded with
SerenityBot posts. Remove the IRC notifications from the CI scripts, and
the Meta script that handles parsing the github actions context into
an IRC message.
2021-05-29 19:35:49 +02:00
Liav A
c1a4dfeffb Kernel/Graphics: Remove unnecessary derived FramebufferDevice classes
It seems like overly-specific classes were written for no good reason.
Instead of making each adapter to have its own unique FramebufferDevice
class, let's generalize everything to keep implementation more
consistent.
2021-05-27 22:39:13 +02:00
Ali Mohammad Pur
0e4431af33 Meta: Run the Wasm spec tests in CI
Since LibWasm is still not capable of passing all of the spec tests,
ignore failing tests, only fail the build if some segfault/abort/etc
occurs.
2021-05-27 17:28:41 +04:30
Ali Mohammad Pur
b2bd5132c4 Meta: Correctly parse numeric literals in wasm tests
This was previously parsing them as hex numbers, causing tests to fail.
With this fix, 88% of the generated tests are passing :^)
2021-05-27 17:28:41 +04:30
Max Wipfli
a272c04c8a
Base: Make desktop shortcuts owned by anon (#7495)
This fixes #7492.
2021-05-27 08:52:46 +02:00
Gunnar Beutner
a808fff2ec Revert "Revert "Kernel: Fix PCI layout of i440fx QEMU machine""
This reverts commit 72c097530f.

With that patch applied audio doesn't work anymore.

Fixes #7445.
2021-05-25 09:38:25 +02:00
Itamar
b9021f8631 Meta: Exclude LibCpp&LanguageServer tests from check-newlines-at-eof.py 2021-05-22 15:52:11 +02:00
Liav A
72c097530f Revert "Kernel: Fix PCI layout of i440fx QEMU machine"
This reverts commit 5018b3b4b7.

Let's help our future selves by making sure we don't introduce a bug
because of duplicating a network interface name or related bug to this
topic. Therefore, we can have multiple e1000 devices in the system now.
2021-05-22 11:19:50 +01:00
Ali Mohammad Pur
b808815e57 Meta: Display DistinctNumeric as its alias name in GDB if possible
All DistinctNumerics are given an identifying tag, if the tag is
generated by the macro, print the alias instead of DistinctNumeric.
2021-05-22 13:21:00 +04:30
Ali Mohammad Pur
3d0786f96b Meta: Add GDB pretty printer for AK::Variant 2021-05-22 13:21:00 +04:30
Ali Mohammad Pur
37651a28e1 Meta: Pretty-print the types in serenity_gdb.py
DistinctNumeric<T, ...> and some other types are very long, but the
template arguments provide no particular value, so just don't show them
2021-05-22 13:21:00 +04:30
Gunnar Beutner
c3efae85f2 Games: Add Hearts 2021-05-21 23:38:18 +02:00
Liav A
5018b3b4b7 Kernel: Fix PCI layout of i440fx QEMU machine
Some folks on discord said adding another e1000 network adapter made it
so we don't have networking on the system anymore.
To fix this, we will use other unsupported PCI device instead.
2021-05-21 21:20:10 +02:00
Liav A
f27e75ac0c Meta: Make i440fx QEMU machine PCI hierarchy a bit more complex
Let's help our future selves by ensuring we have proper support for
secondary PCI buses always.
2021-05-21 17:58:53 +01:00
Brian Gianforcaro
bd1bdbe91b Meta: Add GDB pretty printer for AK::SinglyLinkedList 2021-05-21 15:23:01 +02:00
Brian Gianforcaro
0fbc5893bf Meta: Add GDB pretty printer for AK::InlineLinkedList
This allows a developer to easily dump a InlineLinkedList in the
debugger without having to manually running the list.
I needed this for a recent bug investigation in the Kernel.
2021-05-21 15:23:01 +02:00
Andrew Kaster
a5889b9aad Shell: Hide job times behind SHELL_JOB_DEBUG flag 2021-05-21 12:05:34 +04:30
Ali Mohammad Pur
24b2a6c93a LibWasm+Meta: Implement instantiation/execution primitives in test-wasm
This also optionally generates a test suite from the WebAssembly
testsuite, which can be enabled via passing `INCLUDE_WASM_SPEC_TESTS`
to cmake, which will generate test-wasm-compatible tests and the
required fixtures.
The generated directories are excluded from git since there's no point
in committing them.
2021-05-21 00:15:23 +01:00
Ali Mohammad Pur
b3c13c3e8a LibWasm+Meta: Add test-wasm and optionally test the conformance tests
This only tests "can it be parsed", but the goal of this commit is to
provide a test framework that can be built upon :)
The conformance tests are downloaded, compiled* and installed only if
the INCLUDE_WASM_SPEC_TESTS cmake option is enabled.
(*) Since we do not yet have a wast parser, the compilation is delegated
to an external tool from binaryen, `wasm-as`, which is required for the
test suite download/install to succeed.
This *does* run the tests in CI, but it currently does not include the
spec conformance tests.
2021-05-21 00:15:23 +01:00
Ali Mohammad Pur
ba2fce14d3 Meta: Add a Wasm parser fuzzer 2021-05-21 00:15:23 +01:00
Andreas Kling
59fec42a25 StateMachineGenerator: Put output into the CMake build directory
Don't pollute the source directory with generated code.
2021-05-20 18:10:59 +02:00
Ali Mohammad Pur
c6b12841ee Meta: Make generate_state_machine() generate a proper target
And use GENERATED_SOURCES (or add_dependencies) to make LibVT depend on
that target.
Fixes a FIXME.
2021-05-20 12:11:27 +01:00
Itamar
832e9c6e02 LibCpp: Add regression tests for the parser
For each .cpp file in the test suite data, there is a .ast file that
represents the "known good" baseline of the parser result.

Each .cpp file goes through the parser, and the result of
invoking `ASTNode::dump()` on the root node is compared to the
baseline to find regressions.

We also check that there were no parser errors when parsing the .cpp
files.
2021-05-19 23:19:07 +02:00
Itamar
eeb98335d5 CppLanguageServer: Put cpp test files in /home/anon/cpp-tests/
This is similar to the LibJS test data that resides in
/home/anon/js-tests.
It's more convenient than storing the test programs as raw strings
in the code.
2021-05-19 23:19:07 +02:00
Ali Mohammad Pur
f137c1bfaa LibJS+LibTest: Move out the test-js test runner into LibTest 2021-05-18 18:48:15 +01:00
stelar7
24c5b0e81c LibGfx: Add support for DDS images 2021-05-18 08:45:53 +01:00
Ali Mohammad Pur
dfb2178519 Meta: Build LibWasm and the wasm utility as part of Lagom 2021-05-17 23:25:30 +02:00
Ali Mohammad Pur
056be42c0b LibWasm: Start implementing a naive bytecode interpreter
As the parser now flattens out the instructions and inserts synthetic
nesting/structured instructions where needed, we can treat the whole
thing as a simple parsed bytecode stream.
This currently knows how to execute the following instructions:
- unreachable
- nop
- local.get
- local.set
- {i,f}{32,64}.const
- block
- loop
- if/else
- branch / branch_if
- i32_add
- i32_and/or/xor
- i32_ne

This also extends the 'wasm' utility to optionally execute the first
function in the module with optionally user-supplied arguments.
2021-05-17 23:25:30 +02:00
Andreas Kling
a15c7b7944 Build: Stop using precompiled headers (PCH)
This had very bad interactions with ccache, often leading to rebuilds
with 100% cache misses, etc. Ali says it wasn't that big of a speedup
in the end anyway, so let's not bother with it.

We can always bring it back in the future if it seems like a good idea.
2021-05-17 19:30:12 +02:00
Siddharth Kapoor
dbd9d13857
Meta: Run 'du' with '--apparent-size', except on macOS
Fixes #7172.
2021-05-16 22:50:46 +01:00
Liav A
2e565f1b8a Meta: Update grub configuration to adopt the new textual boot mode 2021-05-16 19:58:33 +02:00
Liav A
20743e8aed Kernel/Graphics + SystemServer: Support text mode properly
As we removed the support of VBE modesetting that was done by GRUB early
on boot, we need to determine if we can modeset the resolution with our
drivers, and if not, we should enable text mode and ensure that
SystemServer knows about it too.

Also, SystemServer should first check if there's a framebuffer device
node, which is an indication that text mode was not even if it was
requested. Then, if it doesn't find it, it should check what boot_mode
argument the user specified (in case it's self-test). This way if we
try to use bochs-display device (which is not VGA compatible) and
request a text mode, it will not honor the request and will continue
with graphical mode.

Also try to print critical messages with mininum memory allocations
possible.

In LibVT, We make the implementation flexible for kernel-specific
methods that are implemented in ConsoleImpl class.
2021-05-16 19:58:33 +02:00
Liav A
cc92538d49 Kernel/Graphics: Add basic support for Intel native accelerator
We simply modeset the resolution after determining the preferred
resolution after getting the EDID from the attached display.
2021-05-16 19:58:33 +02:00
Liav A
8515a1c49d Meta: Boot the Q35 machine without VGA support
Use the bochs-display device instead :)
2021-05-16 19:58:33 +02:00
Gunnar Beutner
f0fa51773a AK+Userland: Fix some compiler warnings and make variables const-ref
This fixes a few compiler warnings and makes some variables const-ref
in preparation for the next commit which changes how ByteBuffer works.
2021-05-16 17:49:42 +02:00
Timothy Flynn
ce030ca584 AK+Meta: Add a debug option for Solitaire 2021-05-16 16:37:51 +02:00
Daniel Bertalan
be519022c3 LibVT: Implement new ANSI escape sequence parser
This commit replaces the former, hand-written parser with a new one that
can be generated automatically according to a state change diagram.

The new `EscapeSequenceParser` class provides a more ergonomic interface
to dealing with escape sequences. This interface has been inspired by
Alacritty's [vte library](https://github.com/alacritty/vte/).

I tried to avoid changing the application logic inside the `Terminal`
class. While this code has not been thoroughly tested, I can't find
regressions in the basic command line utilities or `vttest`.

`Terminal` now displays nicer debug messages when it encounters an
unknown escape sequence. Defensive programming and bounds checks have
been added where we access parameters, and as a result, we can now
endure 4-5 seconds of `cat /dev/urandom`. :D

We generate EscapeSequenceStateMachine.h when building the in-kernel
LibVT, and we assume that the file is already in place when the userland
library is being built. This will probably cause problems later on, but
I can't find a way to do it nicely.
2021-05-16 11:50:56 +02:00
Idan Horowitz
3f08e957d4 Meta: Add a check for periods on the end of titles to commit linter 2021-05-16 01:25:24 +01:00
Linus Groh
9459f3728c Meta: Check that copyright headers are followed by a blank line 2021-05-15 00:28:30 +01:00
Linus Groh
5ee9aab7e1 Meta: Bump BIOS/MBR boot partition size of grub disk image to 1MiB
As of ~April 2021 the Meta/build-image-grub.sh script no longer works
for me (on Fedora 34) and fails with the following error:

    /usr/sbin/grub2-install: warning: ../grub-core/partmap/msdos.c:403:
    your core.img is unusually large. It won't fit in the embedding
    area.

    /usr/sbin/grub2-install: warning: Embedding is not possible. GRUB
    can only be installed in this setup by using blocklists. However,
    blocklists are UNRELIABLE and their use is discouraged..

    /usr/sbin/grub2-install: error: will not proceed with blocklists.

Changing the size of the boot partition from 32 kiB to 1 MiB (2048
sectors) fixes the issue. This is also described in the following Ubuntu
grub2 bug (as well as 40 duplicates!) from 2012, which suggests the same
fix: https://bugs.launchpad.net/ubuntu/+source/grub2/+bug/1059827

The Arch Linux wiki also uses 1 MiB in their BIOS/MBR examples for
parted: https://wiki.archlinux.org/title/Parted

I'm not sure why this suddenly stopped working, however I was able to
boot with an image created with this change applied.
2021-05-15 00:57:35 +02:00
Andreas Kling
d039542c7c AK: Remove unused STRINGIMPL_DEBUG instrumentation 2021-05-14 17:17:32 +02:00
Brian Gianforcaro
9c38475608 Kernel: Add the ability to verify we don't kmalloc under spinlock.
Ideally we would never allocate under a spinlock, as it has many
performance and potentially functionality (deadlock) pitfalls.

We violate that rule in many places today, but we need a tool to track
them all down and fix them. This change introduces a new macro option
named `KMALLOC_VERIFY_NO_SPINLOCK_HELD` which can catch these
situations at runtime via an assert.
2021-05-14 13:28:21 +02:00
Andrew Kaster
d81f52e529 Lagom: Enable sanitizer builds with gcc
Previously the CMake options for -fsanitize=address, thread and
undefined were gated behind clang, which was unecessary. Only
-fsanitize=fuzzer is clang-only.
2021-05-14 08:34:00 +01:00
Brian Gianforcaro
57385a1c29 CMake: Make missing medium icon a FATAL_ERROR
Now that all of the medium icons pass this check, we can make it
FATAL_ERROR to stop any new violations from being checked in.
2021-05-13 23:45:50 +02:00
DexesTTP
5963f6f9ff LibCrypto: Split BigInteger operations into an Algorithms class
Since the operations are already complicated and will become even more
so soon, let's split them into their own files. We can also integrate
the NumberTheory operations that would better fit there into this class
as well.

This commit doesn't change behaviors, but moves the allocation of some
variables into caller classes.
2021-05-13 19:18:07 +01:00
Brian Gianforcaro
8693c925a0 CMake: Fix message levels for error conditions during configuration
Make messages which should be fatal, actually fail the build.

- FATAL is not a valid mode keyword. The full list is available in the
  docs: https://cmake.org/cmake/help/v3.19/command/message.html

- SEND_ERROR doesn't immediately stop processing, FATAL_ERROR does.
  We should immediately stop if the Toolchain is not present.

- The app icon size validation was just a WARNING that is easy to
  overlook. We should promote it to a FATAL_ERROR so that people will
  not overlook the issue when adding a new application. We can only make
  the small icon message FATAL_ERROR, as there is currently one
  violation of the medium app icon validation.
2021-05-13 18:52:48 +02:00
DolphinChips
5d4f521c9d Meta: Add script to build image with EXTLINUX bootloader 2021-05-12 09:25:03 +01:00
DolphinChips
c1775a908c Meta: Add EXTLINUX config 2021-05-12 09:25:03 +01:00
Matthew Olsson
8c745ad0d9 LibPDF: Parse page structures
This commit introduces the ability to parse the document catalog dict,
as well as the page tree and individual pages. Pages obviously aren't
fully parsed, as we won't care about most of the fields until we
start actually rendering PDFs.

One of the primary benefits of the PDF format is laziness. PDFs are
not meant to be parsed all at once, and the same is true for pages.
When a Document is constructed, it builds a map of page number to
object index, but it does not fetch and parse any of the pages. A page
is only parsed when a caller requests that particular page (and is
cached going forwards).

Additionally, this commit also adds an object_cast function which
logs bad casts if DEBUG_PDF is set. Additionally, utility functions
were added to ArrayObject and DictObject to get all types of objects
from the collections to avoid having to manually cast.
2021-05-10 10:32:39 +02:00
Eric Butler
1a48609c6b Meta: Always try genext2fs as fallback to build disk image
If mounting disk image fails (e.g. fuse is not available on macos),
always try using genext2fs before giving up.
2021-05-09 15:34:12 +02:00
Dylan Katz
984b6e08cf LibSQL: Add a syntax highlighter 2021-05-09 09:39:05 +02:00
Ali Mohammad Pur
aa4d8d26b9 LibWasm: Start implementing a basic WebAssembly binary format parser
This can currently parse a really simple module.
Note that it cannot parse the DataCount section, and it's still missing
almost all of the instructions.
This commit also adds a 'wasm' test utility that tries to parse a given
webassembly binary file.
It currently does nothing but exit when the parse fails, but it's a
start :^)
2021-05-08 22:14:39 +02:00
Ali Mohammad Pur
62af7c4bdf AK+LibCpp: Remove DEBUG_SPAM in favour of per-application defines
What happens if one file defines DEBUG_SPAM, and another doesn't,
then we link them together and get ODR violations? -- @ADKaster
2021-05-08 22:14:39 +02:00
Jesse Buhagiar
4807d32139 LibGL: Implement a basic OpenGL 1.x compatible library
This currently (obviously) doesn't support any actual 3D hardware,
hence all calls are done via software rendering.

Note that any modern constructs such as shaders are unsupported,
as this driver only implements Fixed Function Pipeline functionality.

The library is split into a base GLContext interface and a software
based renderer implementation of said interface. The global glXXX
functions serve as an OpenGL compatible c-style interface to the
currently bound context instance.

Co-authored-by: Stephan Unverwerth <s.unverwerth@gmx.de>
2021-05-08 10:13:22 +02:00
Brian Gianforcaro
7e28ecc305 Meta + Lagom: Fix paths after movement of tests to Tests/
Not sure how this didn't cause a build break when I originally
moved them in #6891. Better fix them now.
2021-05-08 00:04:10 +01:00
Brian Gianforcaro
1162e71a5c Meta: Remove AK/Tests from check-newlines-at-eof.py
The json file was removed a while back, and now AK/Tests has been
moved to Tests/AK. So this is wrong and out of date in every way.
2021-05-08 00:04:10 +01:00
Brian Gianforcaro
9720ad3901 Tests: Move Userland/Utilities/test-js to Tests/LibJS 2021-05-08 00:04:10 +01:00
Linus Groh
867072c7d8 Meta: Improve man.serenityos.org titles and link names
Index page:
- Change links from "Man 1" to "Section 1"

Section index pages:
- Change title from "1" to "Section 1 - SerenityOS man pages"
- Change links from "foo" to "foo(1)"

Man pages:
- Change title from "foo" to "foo(1) - SerenityOS man pages"
2021-05-07 22:28:33 +02:00
Linus Groh
db06b106ae Meta: Fix error in lint-ports.py
The data structures here were changed from sets to dicts at some point,
with the sets now having different names - this would crash trying to
subtract two dicts.
2021-05-07 20:08:45 +01:00
Brian Gianforcaro
dd633b9dd1 Meta: Fix Fuzzers CMakeLists.txt and ReadMe.md to use CXX_COMPILER_ID
Previously the directions omitted that you have to specify
`-CMAKE_CXX_COMPILER` when building the Fuzzers. This
would cause all kinds of weird problems at compilation and
link time. You can't specify one or the other, they must
both be pointing at clang in order for things to work as
experted. Fix this by updating the documentation to specify
that the user should specify both the C and CXX compiler explicitly
to be safe, as well as forcing the cmake clang argument handling
to modify the CXX compiler variable instead of the C version.
2021-05-07 15:19:48 +01:00
Andreas Kling
f142b43e89 Base: Make the /bin/TextEditor desktop shortcut say "Text Editor" :^) 2021-05-06 17:54:36 +02:00
Brian Gianforcaro
83dca542bb Meta: Enable linting of shell scripts under Toolchain
Now that everything under Toolchain is shellcheck clean,
remove it from the exception list.
2021-05-05 21:26:37 +02:00
Idan Horowitz
b9c367e13b Meta: Add action to tweet each commit on push 2021-05-05 21:12:09 +02:00
Idan Horowitz
fbc93a3a2f
Meta: Remove link to man6 from man.serenityos.org
We don't currently have any man6 entries.
2021-05-04 22:02:50 +01:00
Idan Horowitz
8cc6372b14 Meta: Strip man prefix from generated man page directories 2021-05-04 22:05:12 +02:00
Idan Horowitz
d29f17e882 Meta: Use correct hrefs for man pages in man.serenityos.org/index.html 2021-05-04 22:05:12 +02:00
Ali Mohammad Pur
8449521064 Meta: Remove existing test directories before copying new ones in
Previously, we would end up with `js-tests/Tests` and `web-tests/Tests`
because the previous directories were already there.
2021-05-04 21:55:30 +02:00
Idan Horowitz
d29e2dd2d7 Meta: Add workflow that deploys man page updates to man.serenityos.org 2021-05-04 20:58:25 +02:00
Idan Horowitz
028dad6e87 Meta: Add a post-commit commit message linter hook
This should help with getting commit messages tidy before they pass
through CI's commit linter :^)

For this hook to work pre-commit has to be explicitly installed via:
`pre-commit install --hook-type commit-msg`
2021-05-02 16:28:01 +02:00
Idan Horowitz
5c385d06e8 Lagom/Fuzzers: Add fuzzers for Windows-1251 and Windows-1255 decoders 2021-05-01 17:59:08 +02:00
Carlos César Neves Enumo
69e2431c64 Lagom/CMake: Add -fconstexpr-steps for AppleClang 2021-05-01 07:38:43 +02:00
Linus Groh
4d697855ea Meta: Use author username for pull request IRC notifications
Just 'github.actor' may or may not be the actual PR author, but
especially since action runs have to be approved for first-time
contributors, it's been giving us a lot of incorrect results.
2021-04-30 23:11:12 +02:00
Brian Gianforcaro
f91bfe8009 Meta: pre-commit should run lint-ports.py only when Ports change
Most of the existing lint-ing shell scripts have the ability
to only run on the files which have actually changed.
The new port lint-ing script doesn't have this functionality
unfortunately. This forces us to lint ALL the ports on every
single change to any other file in the system if you have
the pre-commit hook setup for your git clone locally.

Instead we can use pre-commit's feature to only run a hook
if certain files have changed to reduce the situations in
which we would run the Meta/lint-ports.py script.
2021-04-30 21:24:22 +02:00
Andreas Kling
7ae7170d61 Everywhere: "file name" => "filename" 2021-04-29 22:16:18 +02:00
Andreas Kling
def1f1444a WindowServer: Move configuration file to /etc/WindowServer.ini
This was in the /etc/WindowServer/ directory which had nothing else in
it, so let's just get rid of the directory and move this up one step.
2021-04-29 22:16:18 +02:00
Gunnar Beutner
b861259098 Meta: Ensure the tap device is removed before trying to create it again
Sometimes the tap device isn't destroyed depending on how the script
exits. Running the script again then fails to create the device
again.
2021-04-29 20:26:13 +02:00
Idan Horowitz
33fdd402b5 Meta: Increase fconstexpr-steps for Clang Lagom builds
Clang's default constexpr-steps limit is 1048576, which is not enough
for LibGfx's generation of the unicode bidirectional class lookup table
while GCC doesn't have any limit at all, so this patch increases the
limit to an arbitrarily larger value.
2021-04-29 10:36:23 +02:00
Linus Groh
da72c6987f Meta: Make copyright header check more strict 2021-04-29 00:59:26 +02:00
Gunnar Beutner
6652ce15a4 Meta: Don't run qemu as root
This currently only supports Linux but I don't think anyone else
ran this yet because they'd have run into the E1000 bug I fixed
in #6669
2021-04-27 12:00:12 +02:00
Gunnar Beutner
1117b6d833 Meta: Make sure traceroot and ping belong to the root user 2021-04-26 21:10:05 +02:00
Gunnar Beutner
4aaf6386ae Meta: Only allow sha256 and sig for auth_type in ports 2021-04-25 13:30:18 +02:00
Andrew Kaster
35c0a6c54d AK+Userland: Move AK/TestSuite.h into LibTest and rework Tests' CMake
As many macros as possible are moved to Macros.h, while the
macros to create a test case are moved to TestCase.h. TestCase is now
the only user-facing header for creating a test case. TestSuite and its
helpers have moved into a .cpp file. Instead of requiring a TEST_MAIN
macro to be instantiated into the test file, a TestMain.cpp file is
provided instead that will be linked against each test. This has the
side effect that, if we wanted to have test cases split across multiple
files, it's as simple as adding them all to the same executable.

The test main should be portable to kernel mode as well, so if
there's a set of tests that should be run in self-test mode in kernel
space, we can accomodate that.

A new serenity_test CMake function streamlines adding a new test with
arguments for the test source file, subdirectory under /usr/Tests to
install the test application and an optional list of libraries to link
against the test application. To accomodate future test where the
provided TestMain.cpp is not suitable (e.g. test-js), a CUSTOM_MAIN
parameter can be passed to the function to not link against the
boilerplate main function.
2021-04-25 09:36:49 +02:00
Gunnar Beutner
511ffa8d68 Meta: Support using rsync to install the root filesystem
Using rsync is significantly faster when we're using an existing
image because we only have to copy files which are new or have
been updated. This cuts down the image creation time to about
a second or two assuming an old image exists.
2021-04-23 22:34:05 +02:00
Gunnar Beutner
479905be6c Meta: Re-use existing disk image where possible
This adds support for re-using and re-sizing existing disk images.
Disk images are checked with e2fsck prior to re-use and a new disk
image is automatically created when that check fails.
2021-04-23 22:34:05 +02:00
Gunnar Beutner
b3db01e20e Ports: Detect more types of errors in the AvailablePorts.md file
This adds support for detecting incorrect version numbers and links
in the ports list.

Also, unlike before it doesn't parse the package.sh script but executes
it instead which allows us to detect syntax errors.
2021-04-23 16:11:48 +02:00
Linus Groh
43f56ced73 Meta: Remove sync-local.sh move warning from build-root-filesystem.sh 2021-04-22 23:08:20 +02:00
Brian Gianforcaro
1682f0b760 Everything: Move to SPDX license identifiers in all files.
SPDX License Identifiers are a more compact / standardized
way of representing file license information.

See: https://spdx.dev/resources/use/#identifiers

This was done with the `ambr` search and replace tool.

 ambr --no-parent-ignore --key-from-file --rep-from-file key.txt rep.txt *
2021-04-22 11:22:27 +02:00
Linus Groh
696f23d7a0 Meta: Add basic Zsh completions for serenity.sh
This patch adds a basic Zsh completion script for the commands and
targets provided by Meta/serenity.sh. There's some room for improvement
here, e.g. we could provide completion for available CMake targets -
currently completion stops after serenity.sh <command> <target>.

You can enable it by adding this to your .zshrc before completions are
loaded:

    fpath=($SERENITY_SOURCE_DIR/Meta/ShellCompletions/zsh $fpath)
2021-04-22 09:55:48 +02:00
Gunnar Beutner
232e64c10a Meta: Add GDB pretty printers 2021-04-22 00:45:43 +02:00
Ali Mohammad Pur
468ac11f29 Meta: Add an option to precompile some very common AK headers
Until we get the goodness that C++ modules are supposed to be, let's try
to shave off some parse time using precompiled headers.
This commit only adds some very common AK headers, only to binaries,
libraries and the kernel (tests are not covered due to incompatibility
with AK/TestSuite.h).
This option is on by default, but can be disabled by passing
`-DPRECOMPILE_COMMON_HEADERS=OFF` to cmake, which will disable all
header precompilations.
This makes the build about 30 seconds faster on my machine (about 7%).
2021-04-21 14:29:46 +02:00
Marco Biscaro
8124719c3d Tests: Reorganize LibCompress unit tests
Move LibCompress unit tests to LibCompress/Tests directory and register
them with CMake's add_test. This allows us to run these tests with
ninja test instead of running a separate executable.

Also split the existing tests in 3 test files that better follow the
source code structure (inspired by AK tests).
2021-04-21 08:00:32 +02:00
Timothy Flynn
110cd98c0a Lagom: Add sql utility and LibSQL unit tests 2021-04-20 18:28:34 +02:00
Timothy Flynn
55b7b8e930 AK+Meta: Add a debug option for LibSQL 2021-04-20 18:28:34 +02:00
Gunnar Beutner
2d62cf8b79 Ports: Update the lint-ports.py script to ignore missing auth_type for SerenityOS repositories 2021-04-20 17:04:51 +02:00
Panagiotis Vasilopoulos
e45e0eeb47 Everywhere: Replace SERENITY_ROOT with SERENITY_SOURCE_DIR 2021-04-20 15:27:52 +02:00
Brian Gianforcaro
8f6a5a1c39 Meta: Add a rebuild-world command to serenity.sh
This was brought up as something that would be useful by
`RealKC` on the discord, and I happened to agree that it
would be useful. Especially given the abundance of Toolchain
changes recently.
2021-04-20 08:10:21 +02:00
Brian Gianforcaro
c195ee6fd2 Meta: Add allow-list for icon size detection in CMake
The only icons we are currently warning about are designed
and rendered as small icons intentionally, as their only use
is in desktop applets, and thus are exempt to this rule.

This reduces build spam back down to a minimum.
I should have just done this in the first place, back in #4729
2021-04-20 08:10:21 +02:00
Brendan Coles
3c4dc5cb11 Meta: Remove references to Userland/Libraries/LibELF/exec_elf.h 2021-04-19 09:19:31 +02:00
FalseHonesty
969c73660b Meta: Mark x86 debug register macros as false positives for CI 2021-04-18 17:02:40 +02:00
Linus Groh
a48d365046 Meta: Replace /bin/env with /usr/bin/envin serenity.sh shebang
This is more portable.
2021-04-18 14:01:52 +02:00
Gunnar Beutner
aa254ffd66 Meta: Update check-style.sh to ignore CVS $id$ tags
Userlands/Libraries/LibC/sys/exec_elf.h has an $id$ tag
which fails this lint check.
2021-04-18 10:55:25 +02:00
Gunnar Beutner
6cb28ecee8 LibC+LibELF: Implement support for the dl_iterate_phdr helper
This helper is used by libgcc_s to figure out where the .eh_frame sections
are located for all loaded shared objects.
2021-04-18 10:55:25 +02:00
Linus Groh
2ac9790883 Meta: Remove stray newline from serenity.sh help text 2021-04-17 19:16:19 +02:00
Idan Horowitz
e4d9fa914e Kernel: Add base support for VirtRNG (VirtIO based Hardware RNG)
This is a very basic implementation that only requests 4096 bytes
of entropy from the host once, but its still high quality entropy
so it should be a good fix for #4490 (boot-time entropy starvation)
for virtualized environments.

Co-authored-by: Sahan <sahan.h.fernando@gmail.com>
2021-04-17 10:21:23 +02:00
Idan Horowitz
d1f7a2f9a5 Kernel: Finish base implementation of VirtQueues
This commit includes a lot of small changes and additions needed to
finalize the base implementation of VirtIOQueues and VirtDevices:
* The device specific driver implementation now has to handle setting
up the queues it needs before letting the base device class know it
finised initialization
* Supplying buffers to VirtQueues is now done via ScatterGatherLists
instead of arbitary buffer pointers - this ensures the pointers are
physical and allows us to follow the specification in regards to the
requirement that individual descriptors must point to physically
contiguous buffers. This can be further improved in the future by
implementating support for the Indirect-Descriptors feature (as
defined by the specification) to reduce descriptor usage for very
fragmented buffers.
* When supplying buffers to a VirtQueue the driver must supply a
(temporarily-)unique token (usually the supplied buffer's virtual
address) to ensure the driver can discern which buffer has finished
processing by the device in the case in which the device does not
offer the F_IN_ORDER feature.
* Device drivers now handle queue updates (supplied buffers being
returned from the device) by implementing a single pure virtual
method instead of setting a seperate callback for each queue
* Two new VirtQueue methods were added to allow the device driver
to either discard or get used/returned buffers from the device by
cleanly removing them off the descriptor chain (This also allows
the VirtQueue implementation to reuse those freed descriptors)

This also includes the necessary changes to the VirtIOConsole
implementation to match these interface changes.

Co-authored-by: Sahan <sahan.h.fernando@gmail.com>
2021-04-17 10:21:23 +02:00
Idan Horowitz
ecfa7cb824 Kernel: Implement a naive version of virtconsole by memcpying to physical page
This patch allocates a physical page for each of the virtqueues and
memcpys to it when receiving a buffer to get a physical, aligned
contiguous buffer as required by the virtio specification.

Co-authored-by: Sahan <sahan.h.fernando@gmail.com>
2021-04-17 10:21:23 +02:00
Idan Horowitz
62303d46d1 Kernel: Add base support for VirtIO devices
Based on pull #3236 by tomuta, this adds helper methods for generic
device initialization, and partily-broken virtqueue helper methods

Co-authored-by: Tom <tomut@yahoo.com>
Co-authored-by: Sahan <sahan.h.fernando@gmail.com>
2021-04-17 10:21:23 +02:00
Brian Gianforcaro
253114e3b1 Meta: Allow serenity.sh to be used outside of assumed working directory
This change fixes two bugs:

1) If you run `serenity.sh` outside of your serenity git clone, the
   `get_top_dir()` function won't be able to auto detect the serenity
    root dir and we'll error out. By allowing the script to use an
    existing $SERENITY_ROOT vlaue if it exists, we can solve
    this problem.

2) If tried to run a command which ends up calling `build_toolchain()`
   and you were outside of the root of the project, it should just
   fail. Fix this by utilizing `$SERENITY_ROOT`.
2021-04-17 09:27:19 +02:00
Brendan Coles
bb6bb7bc5e Meta: lint-ports: Check package files for required properties 2021-04-16 21:14:00 +02:00
Brian Gianforcaro
265e155181 Meta: Use basename for serenity.sh help message
I have this symlinked into ~/bin, when looking at the help/usage
it would previously print the fully qualified path to the script
making the help very difficult to read.
2021-04-15 17:47:09 +02:00
Peter Elliott
938924f36d Meta: Add install-ports CMake target
install-ports copys the necessary files from Ports/ to /usr/Ports. Also
refactor the compiler and destiation variables from .port_include.sh
into .hosted_defs.sh. .hosted_defs.sh does not exists when ports are
built in serenity
2021-04-12 14:06:24 +02:00
Andreas Kling
251018676f Everywhere: Update references from ReadMe.md => README.md 2021-04-11 10:52:25 +02:00
Andreas Kling
19987a9112 Meta: Update the screenshot in the ReadMe :^)
It's been almost a year since the last one, and things look a bit
different so let's add a new screenshot.
2021-04-04 09:57:36 +02:00
Liav A
8e3e3a71cb Kernel: Introduce a new HID subsystem
The end goal of this commit is to allow to boot on bare metal with no
PS/2 device connected to the system. It turned out that the original
code relied on the existence of the PS/2 keyboard, so VirtualConsole
called it even though ACPI indicated the there's no i8042 controller on
my real machine because I didn't plug any PS/2 device.
The code is much more flexible, so adding HID support for other type of
hardware (e.g. USB HID) could be much simpler.

Briefly describing the change, we have a new singleton called
HIDManagement, which is responsible to initialize the i8042 controller
if exists, and to enumerate its devices. I also abstracted a bit
things, so now every Human interface device is represented with the
HIDDevice class. Then, there are 2 types of it - the MouseDevice and
KeyboardDevice classes; both are responsible to handle the interface in
the DevFS.

PS2KeyboardDevice, PS2MouseDevice and VMWareMouseDevice classes are
responsible for handling the hardware-specific interface they are
assigned to. Therefore, they are inheriting from the IRQHandler class.
2021-04-03 11:57:23 +02:00
Brendan Coles
666aeecaa2 Meta: Resolve some pylint violations in Python lint scripts
Resolves:

* all: consider-using-sys-exit
* all: wrong-import-order
* all: TODO: Require that a few keys are set? (fixme)
* some: missing-function-docstring
* some: line-too-long
2021-04-02 23:07:58 +02:00
Linus Groh
f418115f1b LibJS: Add initial support for Promises
Almost a year after first working on this, it's finally done: an
implementation of Promises for LibJS! :^)

The core functionality is working and closely following the spec [1].
I mostly took the pseudo code and transformed it into C++ - if you read
and understand it, you will know how the spec implements Promises; and
if you read the spec first, the code will look very familiar.

Implemented functions are:

- Promise() constructor
- Promise.prototype.then()
- Promise.prototype.catch()
- Promise.prototype.finally()
- Promise.resolve()
- Promise.reject()

For the tests I added a new function to test-js's global object,
runQueuedPromiseJobs(), which calls vm.run_queued_promise_jobs().
By design, queued jobs normally only run after the script was fully
executed, making it improssible to test handlers in individual test()
calls by default [2].

Subsequent commits include integrations into LibWeb and js(1) -
pretty-printing, running queued promise jobs when necessary.

This has an unusual amount of dbgln() statements, all hidden behind the
PROMISE_DEBUG flag - I'm leaving them in for now as they've been very
useful while debugging this, things can get quite complex with so many
asynchronously executed functions.

I've not extensively explored use of these APIs for promise-based
functionality in LibWeb (fetch(), Notification.requestPermission()
etc.), but we'll get there in due time.

[1]: https://tc39.es/ecma262/#sec-promise-objects
[2]: https://tc39.es/ecma262/#sec-jobs-and-job-queues
2021-04-02 10:47:40 +02:00
Idan Horowitz
3b201da473 Utilities: Add simple traceroute utility
This utility traces the route packets take to a user specified host.

QEMU user networking (the type of networking we currently have setup)
does not support sending "real" raw IPv4 packets, and as such we cant
specify a custom TTL value. As a result, this utility will only work
on real hardware, qemu setup with tun networking (requires root) and
other hypervisors that support bridged adapters (VirtualBox/VMWare).
2021-03-31 23:42:24 +02:00
Luke
1ff6f2b4b2 Lagom/Fuzzers: Add fuzzer for zip file parser 2021-03-27 16:28:34 +01:00
Linus Groh
ad4cc19ca0 Meta: Pass arguments to 'serenity.sh run lagom' executable 2021-03-24 20:38:05 +01:00
Andreas Kling
d20e3dbe8b LibGUI: Remove one ancient GMENU_DEBUG debug log 2021-03-23 20:37:39 +01:00
Itamar
4cb38f6dd8 CI: Don't fail check-symbols if symbol is defiend somewhere else 2021-03-19 22:55:53 +01:00
Andreas Kling
d792200a55 LibJS: Rename GlobalObject::initialize() => initialize_global_object()
This function was shadowing Object::initialize() which cannot be called
on global objects and has a different set of parameters.
2021-03-17 16:53:35 +01:00
Luke
c983e42e8c Lagom/Fuzzers: Add fuzzers for the new Gzip and Deflate compressors 2021-03-14 11:28:12 +01:00
Luke
d27e6f0961 Lagom/Fuzzers: Add fuzzers for Latin 1, Latin 2 and UTF16-BE
No fuzzer for UTF-8 as it (currently) just returns the input.
2021-03-14 11:27:52 +01:00
Jean-Baptiste Boric
800dca3834 Kernel: Implement triply indirect block support in Ext2FSInode 2021-03-13 09:27:18 +01:00
Linus Groh
89602c6fc0 Meta: Support 'serenity.sh gdb lagom' 2021-03-12 21:27:09 +01:00
Linus Groh
eb5b2b4b4f Lagom: Add 'test' command to serenity.sh 2021-03-12 21:27:09 +01:00
Linus Groh
04fc4a8134 Meta: Make 'serenity.sh run lagom' run Lagom executables
Running the tests will be moved to a separate test command which can
then leverage the availability of different targets and run either unit
tests on the host or the image in QEMU in self-test mode. :^)
2021-03-12 21:27:09 +01:00
Linus Groh
1c85ce0324 Meta: Don't depend on toolchain for lagom target in serenity.sh
- Only call ensure_toolchain for non-lagom targets
- Use host addr2line, we can't expect the i686 toolchain's addr2line to
  support the host's binary executable format
- Don't export SERENITY_ARCH and TOOLCHAIN_DIR, don't need them anymore
2021-03-12 21:27:09 +01:00
Linus Groh
cab2982feb Meta: Add lagom_unsupported helper function to serenity.sh 2021-03-12 21:27:09 +01:00
Andreas Kling
9769542bc2 FuzzilliJs: Add missing <errno.h> include 2021-03-12 17:43:48 +01:00
Linus Groh
e93a147f26 Meta: Remove old CLion-specific files
This is not needed anymore, and likely outdated anyway.
2021-03-11 21:01:29 +01:00
Andreas Kling
cd745baa86 Meta: Add KMALLOC_DEBUG to all_the_debug_macros 2021-03-11 15:38:35 +01:00
Tom
929c90f8c8 Meta: Add gdb command to serenity.sh
This uses tmux for a split screen setup, which makes it easy do debug
the kernel while viewing the QEMU output in the same terminal.
2021-03-11 08:29:23 +01:00
Andreas Kling
2fc684f6bc Kernel: Remove ancient FIFO_DEBUG code 2021-03-09 22:10:41 +01:00
Tom
389dddd4b3 Meta: Add a build helper script
This script automatically manages the toolchain and cmake/ninja folders
making it easier to manage the different target architectures.
2021-03-09 07:28:59 +01:00
Andreas Kling
0918dd0460 Website: Add link to @ABigPickle's VLA exploit 2021-03-08 22:53:28 +01:00
Andreas Kling
dfca6b03e4 Website: Reorganize bounty page history section a little bit 2021-03-08 22:53:28 +01:00
Emanuele Torre
26c4cae77c Meta: check-newlines-at-eof.py now checks .json files and files in Base/
This makes it also check man pages and keymap files. :^)
2021-03-08 09:20:53 +01:00
Emanuele Torre
1f81bc6879 Everywhere: Remove unnecessary whitespace at the end of some lines. 2021-03-08 09:20:53 +01:00