1
1
Fork 0
mirror of https://github.com/QB64-Phoenix-Edition/QB64pe.git synced 2024-07-04 04:50:22 +00:00
Commit graph

113 commits

Author SHA1 Message Date
Matthew Kilgore 11a5b8be8e _OpenClient() should return zero on connection failure, not error 2022-11-20 18:44:24 -05:00
Matthew Kilgore 445408d95b _StatusCode() should give the correct error on invalid handle type
Passing a handle of the invalid type (Ex. TCP) to _StatusCode should
give error 52, but it gies error 9.
2022-11-20 04:38:03 -05:00
Matthew Kilgore 12c9c35db5 Add _StatusCode command for HTTP handles
The _StatusCode command returns the status code on the HTTP response
when given a HTTP handle from _OpenClient().
2022-11-20 04:04:02 -05:00
Matthew Kilgore 610c914d36 compile_tests.sh does not display compilelog.txt
Due to a typo, compile_tests.sh was not displaying the compilelog.txt
contents on a test failure.
2022-11-19 15:13:26 -05:00
Matthew Kilgore e8ebf56a2f Add basic http tests
These tests cover basic HTTP functionality via _OPENCLIENT(), and also
that it fails to work without `$Unstable:Http` in place.
2022-11-19 15:13:26 -05:00
Matthew Kilgore 45d52271da Add libqb_http API for HTTP connections
This adds the libqb_http API, which is designed to support HTTP and
HTTPS usage from QB64-PE source.

The design consists of a single thread which services all the HTTP(s)
connections. There are then various libqb_http APIs exposed that allow
interacting with this thread to create a new connection, query
connection status, read data, or close the connection.

Internally the thread makes use of the curl_multi interface to allow a
single thread to service multiple HTTP(s) connections in parallel. This
means you can _OPENCLIENT() multiple HTTP connection in a row and all of
them will be serviced at the same time in whatever order data is
available.

HTTP is optional and selected via a Makefile setting. A stub is swapped
in if HTTP support is not used, which avoids need to add another build
flag to libqb.cpp.
2022-11-19 15:13:26 -05:00
Matthew Kilgore d8a3ec75fd Run tests with -O2
Since we do allow users to use optimization, it's worth running our
tests with it to verify at least those work.
2022-11-19 01:55:20 -05:00
Samuel Gomes 0dd825e5f3 Add -static-libgcc -static-libstdc++ to TEST_CFLAGS-$(win) 2022-11-14 12:15:51 +05:30
Matthew Kilgore c5e2be53f9 Swap bmp test images for png
Functionally it doesn't matter what kind of images we store for the
tests, as _LOADIMAGE() will open them exactly the same. png however has
the advantages of being substantially smaller, and also viewable
directly on GitHub in PRs, making them easier to review.
2022-11-09 21:56:44 -05:00
Matthew Kilgore 8005e62402 Add PAINT tile image-based tests 2022-11-08 01:02:22 -05:00
Matthew Kilgore 37f2ecd4ce Fix setup_osx.command script when run from a different directory
I broke this by accident in 5031de2, likely by misreading the $0.  What
the line was intended to do was change to the directory the script is
located in when the script starts, this allows the script to be started
from any location.

Typically this isn't necessary functionality, but for Mac OS it's
important because if you double-click the script (the typical way to run
it) it is started from the user's home directory. Due to this I also
updated the Mac OS distribution test to run the script in this way so
that it's closer to how a user will run it.

Fixes: #218
2022-10-27 23:26:07 -04:00
Samuel Gomes 7e533a2473 Update test license files 2022-10-25 07:28:35 +05:30
Matt Kilgore 1fa5b8af10
Merge branch 'main' into generate-license-file 2022-10-02 16:25:57 -04:00
Matthew Kilgore d876f1bb22 Add license tests
This adds logic for testing the new license generation functionality.
This is done by having the expected license for a variety of
tests that use different dependencies, and then comparing that against
the license QB64-PE actually produces when compiling these test files.

Note that because the actual used dependencies changes depending upon
the OS, we have separate expected licenses for each of Linux, Windows,
and Mac OS. This required some build changes to accomidate, in addition
to the testing logic changes themselves.
2022-10-01 15:08:01 -04:00
Matthew Kilgore b4d6f52909 Add testsuite of built-in Types 2022-10-01 14:18:53 -04:00
Matthew Kilgore 21b7d60f44 Fix -o to be relative to _STARTDIR$ when source file is
In 094a8c82 we added the ability to compile a source file relative to
_STARTDIR$ instead of the location of the qb64pe executable. This change
fixes `-o` so that it is also treated as relative to _STARTDIR$ when the
provided source file is.

Note that this is not a real behavior change because if the provided
source file is relative to the qb64pe executable then `-o` will be as
well, which matches the previous behavior. The cases where it is made
relative to _STARTDIR$ all produced errors until 094a8c82 was done, so
there was no previous defined behavior.
2022-10-01 04:24:54 -04:00
Matthew Kilgore 094a8c82b2 Fix compiling bas files relative to the CWD
Fix was pulled from QB64Official/qb64#17 by Cory Smith, I just added
tests around it.

Most (all?) compilers allow you to run the compiler from a separate
directory than the compiler itself is located in and compile source
files relative to that directory. QB64-PE however does not allow that,
for a variety of reasons it always search for the provided source file
relative to the location of the QB64-PE compiler rather than the CWD it
was run from. This is pretty unexpected behavior in a lot of cases, and
also doesn't give very helpful error messages either.

This change has us check if the source file exists at the given CWD
location, and if it does we will prepend the CWD to produce the correct
path to the file.

To test that this behavior works as expected I modified
`compile_test.sh` to compile from within the test directories using a
relative path directly to the test file, this fails with current QB64-PE
versions because it can't find the source file.

Additionally, I was unsure of whether this would impact the behavior of
`'$include`, so I added some tests around include that uses various
combinations of paths relative to QB64-PE and relative to the source
file being compiled, and they all find the files as expected so I think
it's fine.
2022-09-30 17:13:43 -04:00
Matthew Kilgore a7cd7884a9 Add CONST tests 2022-09-30 11:23:34 -04:00
Matthew Kilgore c93da8db72 Add tests for SOUND and PLAY "MB"
These tests were intended to be added by #171, but the Linux build was
having problems. The issues with the build have since been resolved so
the tests are getting added back in.

Fixes: #173
2022-09-17 03:06:24 -04:00
Matthew Kilgore 870e67a99b Add $CONSOLE:ONLY and libz tests
libz tests were missing, I added one to test the libz dependency.

Additionally $CONSOLE:ONLY creates many weird interactions and is
currently broken in some cases. This adds tests for all the dependencies
that can work with $CONSOLE:ONLY to verify that they compile correctly.
2022-09-17 03:06:24 -04:00
Matthew Kilgore 2deac87b60 Fix Linux build agent audio problems
It's still not entirely clear what the underlying issue is, but the ALSA
device provided by pulseaudio stops working after so many tests use it.
I've tried various approaches, but simply restarting pulseaudio after
every test is a bruteforce but successful solution. In practice it also
doesn't have any noticeable performance penalty, so it seems like a file
solution.

The `CI_TESTING` environment variable is used to avoid restarting
pulseaudio if the tests aren't being run in the CI environment (we don't
want to restart your pulseaudio instance if you're running them locally!)
2022-09-17 02:41:22 -04:00
Matthew Kilgore cebcb11646 Fix compiling source files with single quotes in name
Using single quotes in a file name wasn't working because the Makefile
was using single quotes itself to quote the filename when providing it
to the compiler. The Makefile was switched to use double quotes instead,
which work just as well but are allowed to contain single quotes inside
of them.

Since double quotes are a legal character to have in a file name on
Linux and Mac OS, I added extra logic to start escaping double quote
characters.

I added a test to verify that we can compile source files with single
quotes in the name. I could not add a test for double quotes since such
files cannot exist on Windows and thsu cannot easily be added to the
repository.
2022-09-09 09:59:43 -04:00
Matthew Kilgore dcc181244c Add test of MIDI unsupported with OpenAL 2022-09-04 23:35:14 -04:00
Matthew Kilgore adb52f4f04 Add support for custom flags on QB64 tests 2022-09-04 23:35:14 -04:00
Matthew Kilgore 2b3403745c Add initial MIDI language support
This adds MIDI support to the language as a new unstable feature. There
are two new metacommands that come with this:

$Unstable: Midi
$MidiSoundFont: [Default|"filename"]

The $Unstable command is required to be able to use any of the other
commands, and just signifies that this is not a full part of the
language yet and may change in breaking ways before the API is
finalized.

The $MidiSoundFont command enables MIDI support in the compiled program,
and also specifies what sound font to use to play MIDI files. "Default"
will make use of the soundfont placed at
'./internal/support/default_soundfont.sf2', and otherwise a filename can
be specified to use any soundfont wanted.

In either case, the selected sound font is compiled into the executable
and then loaded at runtime.

Fixes: #115
2022-09-04 23:35:14 -04:00
Matthew Kilgore 65db95c876 Add support for error tests
This adds support for tests of the error output of QB64-PE. The tests
are in the form of a `.bas` file that does not compile, and a `.err`
file containing the expected output of QB64-PE when producing an error
for that file.

Additionally the `compile_tests` now support multiple tests in a single
folder, via using multiple `.bas` files with different names.
2022-09-04 22:43:30 -04:00
Samuel Gomes 4d4692314e Update rotation test to include more cases 2022-09-02 10:15:07 +05:30
Samuel Gomes adf838cd81 Update _ROL & _ROR test and output 2022-09-01 18:09:47 +05:30
Samuel Gomes a7a4d837ea Added test for _ROL & _ROR 2022-09-01 17:28:12 +05:30
Roland Heyder 2ec897b75d Step 10: Update remaining stuff
- checks all remaining occurrences of the term 'qb64', some remain untouched, some are renamed according to context
- also added new logo for README.md
- this step does finalize the 'Phoenix Edition' re-branding
2022-08-12 02:54:12 +02:00
Roland Heyder e68582b6f2 Step 7: Rename qb64.exe to qb64pe.exe
- Includes related LNX/OSX files
- Excludes mentions in the help (*.txt) files
2022-08-11 18:07:57 +02:00
Roland Heyder face2c883f Step 3: Update test cases
Replaced and renamed icon files, adjusted references in the test.bas files.
2022-08-10 00:51:12 +02:00
github-actions[bot] 72d801e0cd Fix linking static libraries on Windows
In QB64, when linking with an external static library `nm.exe` is used
to determine whether the symbol being used is either a C or C++ symbol,
which determines how the function should be declared in the C++ code.

Unfortunately on Windows the `SHELL` command for `nm.exe` is missing the
`cmd /c`, which means the redirection does not work and consequently
we're unable to find the function declaration via `nm.exe`, which causes
the compilation to fail.

In addition to fixing this, I added tests for `DECLARE STATIC LIBRARY`
for all supported platforms.

Fixes: #112
2022-07-09 14:59:33 -04:00
Matthew Kilgore f2e55cb507 Add script for running C++ tests 2022-06-11 22:47:06 -04:00
Matthew Kilgore da6ccba535 Add buffer API unit tests 2022-06-11 22:47:06 -04:00
Matthew Kilgore e1828f84e1 Add basic C++ testing framework
This is a very simple testing framework for writing and running tests
for C++. The basic idea is that a `struct unit_test` is defined for
every test function to run, and then the test framework simply runs them
one at a time, printing various information about the tests out as ti
goes.

There are also various 'test_assert*()` macros to assert the value of
things while running the tests. They verify a value is equal to an
expected value, and if not it fails the tests. The more specific
assertions like the `ints` and `buffers` ones also print out useful
information on what the expected and actual values were, to aide in
debugging.
2022-06-11 22:47:06 -04:00
Matthew Kilgore 93f47326a7 Add basic C++ testing build logic
This is a fairly flexable build framework for building C++ test
executables. The executables are defined in a list and each can be given
its own set of source files, compiler flags, linker flags, etc. The
test source files are compiled together at the same time to allow any
necessary files to get applied at compile time.

Later a script will run through the test executables.
2022-06-11 22:47:05 -04:00
Matthew Kilgore e250753334 Disable deviceinput test on Linux 2022-06-09 21:30:37 -04:00
Matthew Kilgore 62ec4ebdbd Fix compilation with DEP_DEVICEINPUT
The Makefile changes broke compiling with device input support. This got
missed because no test case for DEP_DEVICEINPUT got added.

Fixes: #100
2022-06-09 21:30:37 -04:00
Matthew Kilgore 930b36a7ae Add missing test for directory with spaces 2022-05-24 00:00:37 -04:00
Matthew Kilgore 9e2177deff Allow EXE name to have spaces in it
Makefile's generally hate spaces in filenames, and it's largely
impossible to make them work. Due to that, with the change to use a
`Makefile` the `EXE=` parameter did not work with spaces, and programs
such as "foo bar.bas" would not compile because it produces "foo
bar.exe" which has a space in the name.

There were options here, but in this very specific case it is actually
possible to allow the Makefile to work with spaces. `EXE` is only a
single filename, so as long as we always quote it correctly and the
provided `EXE=` parameter escapes the spaces with `\` then it will work.

Thus, we modified the Makefile to always do the quoting, and modified
QB64 to automatically escape the spaces in the executable name provided
to the Makefile.

I also modified the `compile_tests` to test that spaces in filenames and
paths of the executable correctly compile.

Fixes: #80
2022-05-22 23:59:06 -04:00
Matthew Kilgore 4a8a7ce594 Redirect stderr to compilelog rather than errorcompilelog
Having two separate files for the compile output is just too confusing,
and it adds an extra file users need to look at and give us when there
are issues. This change simply makes qb64.bas send both the stdout and
stderr output to compilelog.txt.

Fixes: #61
2022-05-18 09:20:30 -04:00
Matthew Kilgore 9b2ea9e1f8 Test that ./internal/temp is empty 2022-05-12 00:21:02 -04:00
Matthew Kilgore cf807de366 Add test of DATA linking 2022-05-12 00:21:02 -04:00
Matthew Kilgore 60cb0c6f82 Clear ./internal/temp between each test 2022-05-12 00:21:02 -04:00
Matthew Kilgore 867dddb1b4 Only copy compilelog files if they exist 2022-05-12 00:21:02 -04:00
Matthew Kilgore 64d32616ea Audio tests cannot be run on Linux
The GitHub runners do not have any sound cards available. We could
potentially install a dummy one but that's a bit too much work right
now.
2022-05-12 00:21:02 -04:00
Matthew Kilgore 23ef0aeca8 Add more tests and dynamic library support 2022-05-12 00:21:02 -04:00
Matthew Kilgore 0fa4fc15ea Fix test 2022-05-12 00:21:02 -04:00
Matthew Kilgore b413028619 Retore errocompilelog, put exes in separate directory
The purpose of moving the EXEs is so that they are not captured in the
build artifacts. They would be nice to have, but they end up being a few
hundred MBs in size so much too large to bother saving.
2022-05-12 00:21:02 -04:00
Matthew Kilgore dedda94a78 Capture compilation error log in tests 2022-05-12 00:21:02 -04:00
Matthew Kilgore ba90a51f3e Don't archive test exes 2022-05-06 17:50:07 -04:00
Matthew Kilgore 2d1e4ec761 Add a few more VERSIONINFO tests 2022-05-06 14:29:37 -04:00
Matthew Kilgore 18c4fc5e5e Add test of relative icon path 2022-05-06 13:42:35 -04:00
Matthew Kilgore a66b9c1ca6 Fix run_tests.sh to report error on failed tests 2022-05-06 13:42:35 -04:00
Matthew Kilgore 3acf3759da Add compile test for combined VERSIONINFO and EXEICON 2022-05-06 13:42:35 -04:00
Matthew Kilgore 55a4d1af1c Verify Windows executable has version information
windres has a handy feature of allowing us to feed it an executable and
it will give an error code depending on whether that executable has a
resource section or not. We can use that feature to create a quick test
to verify the distributable has the resource information on it.
2022-05-06 13:42:35 -04:00
Matthew Kilgore 4330bc1089 Run tests as part of CI 2022-04-28 23:00:07 -04:00
Matthew Kilgore fb12f0445e Don't use a separate output directory 2022-04-28 23:00:07 -04:00
Matthew Kilgore 9ee89d6ff4 Add QBasic tests
These tests use a variety of sample code (with some of the larger files
removed, so they are not complete!) and verifies that they all compile
successfully.
2022-04-28 23:00:07 -04:00
Matthew Kilgore b89e388c2f Add Compilation tests for different dependencies
These tests check that we can compile programs that use a variety of
different sets of dependencies. Each program will only be compiled with
the set of dependencies it relies on.
2022-04-28 23:00:06 -04:00
Matthew Kilgore 5031de2cd6 Add ability to avoid starting QB64 after script is run 2022-04-28 17:21:58 -04:00
Matthew Kilgore 4635b3de59 Add distribution tests 2022-04-28 17:21:58 -04:00