Skip to content

Commit

Permalink
Check that everything works with ptracer and pt-run from /usr/local
Browse files Browse the repository at this point in the history
It's inconvenient to do make install every time we want to run the test suite.
So I set it up to run the /usr/local tests only in the Github CI. To test that
the compilation works with /usr/local version of ptracer.h, clear the CPPFLAGS
variable when compiling the tests.
  • Loading branch information
hugomg committed Aug 10, 2024
1 parent 91e7fb3 commit 6c5cb4c
Show file tree
Hide file tree
Showing 11 changed files with 19 additions and 13 deletions.
12 changes: 9 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,19 @@ jobs:
make
sudo make install
- name: Build
run: |
make all && sudo make install
- name: Build base Library
run: make library && sudo make install

- name: Build test scripts
run: make tests examples CPPFLAGS=''

- name: Install Busted
run: luarocks --local install busted

# To test that everthing works with ptracer.h and pt-run from
# /usr/local, we compile the tests without the "-I" preprocessor
# flag and we don't use "./run-tests". That script adds the current
# directory to the PATH, so it would use the local copy of pt-run.
- name: Run Tests
run: |
eval "$(luarocks path)"
Expand Down
2 changes: 1 addition & 1 deletion examples/fibonacci/fibonacci.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

#define PT_IMPLEMENTATION
#include "ptracer.h"
#include <ptracer.h>

/* User specific macros when Pallene Tracer debug mode is enabled. */
#ifdef PT_DEBUG
Expand Down
1 change: 1 addition & 0 deletions run-tests
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@
# ./run-tests
# ./run-tests -k
# ./run-tests spec/traceback_spec.lua
export PATH="$(pwd):$PATH"
make tests && busted --verbose --no-keep-going "$@"
2 changes: 1 addition & 1 deletion spec/tracebacks/anon_lua/module.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

/* Static use of the library would suffice. */
#define PT_IMPLEMENTATION
#include "ptracer.h"
#include <ptracer.h>

/* Here goes user specifc macros when Pallene Tracer debug mode is active. */
#ifdef PT_DEBUG
Expand Down
2 changes: 1 addition & 1 deletion spec/tracebacks/depth_recursion/module.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

/* Static use of the library would suffice. */
#define PT_IMPLEMENTATION
#include "ptracer.h"
#include <ptracer.h>

/* Here goes user specific macros when Pallene Tracer debug mode is active. */
#ifdef PT_DEBUG
Expand Down
2 changes: 1 addition & 1 deletion spec/tracebacks/dispatch/module.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

/* Static use of the library would suffice. */
#define PT_IMPLEMENTATION
#include "ptracer.h"
#include <ptracer.h>

/* Here goes user specific macros when Pallene Tracer debug mode is active. */
#ifdef PT_DEBUG
Expand Down
2 changes: 1 addition & 1 deletion spec/tracebacks/ellipsis/module.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

/* Static use of the library would suffice. */
#define PT_IMPLEMENTATION
#include "ptracer.h"
#include <ptracer.h>

/* Here goes user specific macros when Pallene Tracer debug mode is active. */
#ifdef PT_DEBUG
Expand Down
2 changes: 1 addition & 1 deletion spec/tracebacks/multimod/module_a.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

#define PT_IMPLEMENTATION
#include "ptracer.h"
#include <ptracer.h>

#include "module_include.h"

Expand Down
2 changes: 1 addition & 1 deletion spec/tracebacks/multimod/module_b.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

#define PT_IMPLEMENTATION
#include "ptracer.h"
#include <ptracer.h>

#include "module_include.h"

Expand Down
2 changes: 1 addition & 1 deletion spec/tracebacks/singular/module.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

/* Static use of the library would suffice. */
#define PT_IMPLEMENTATION
#include "ptracer.h"
#include <ptracer.h>

/* Here goes user specific macros when Pallene Tracer debug mode is active. */
#ifdef PT_DEBUG
Expand Down
3 changes: 1 addition & 2 deletions spec/tracebacks_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@ local function assert_test(example, expected_content)
assert(util.execute("make --quiet tests"))

local cdir = util.shell_quote("spec/tracebacks/"..example)
local ptrun = util.shell_quote("../../../pt-run")
local ok, _, output_content, err_content =
util.outputs_of_execute(string.format("cd %s && %s main.lua", cdir, ptrun))
util.outputs_of_execute(string.format("cd %s && pt-run main.lua", cdir))
assert(not ok, output_content)
assert.are.same(expected_content, err_content)
end
Expand Down

0 comments on commit 6c5cb4c

Please sign in to comment.