Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added tests/ as makefile exclusion, better test building #482

Merged
merged 1 commit into from
Nov 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ VERSION = 3.1.0
SRC_EXT = c
# Path to the source directory, relative to the makefile
SRC_PATH = .
# Exclude dir
EXCLUDE = tests/
# Space-separated pkg-config libraries used by this project
LIBRARIES = ${LIBS}
# Compilation Architecture.
Expand Down Expand Up @@ -136,6 +138,9 @@ ifeq ($(SOURCES),)
SOURCES := $(call rwildcard, $(SRC_PATH), *.$(SRC_EXT))
endif

# Exclude
SOURCES := $(filter-out $(addprefix $(SRC_PATH)/$(EXCLUDE),%), $(SOURCES))

# Set the object file names, with the source directory stripped
# from the path, and the build path prepended in its place
OBJECTS = $(SOURCES:$(SRC_PATH)/%.$(SRC_EXT)=$(BUILD_PATH)/%.o)
Expand Down
2 changes: 1 addition & 1 deletion tests/centerpixel.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include "helper.h"

int
jnzjmp(void)
main(void)
{
__test__start_basic();

Expand Down
3 changes: 1 addition & 2 deletions tests/helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ __Create_Window(unsigned int color, int bw, int bwcolor)
{
XSetWindowAttributes wa =
{
.bit_gravity = NorthWestGravity,
///NorthWestGravity,
.bit_gravity = StaticGravity,
.backing_store = WhenMapped,
.border_pixel = bwcolor,
.background_pixel = color
Expand Down
8 changes: 8 additions & 0 deletions tests/make_test
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash




gcc centerpixel.c -o centerpixel -lX11
gcc restack.c -o restack -lX11
gcc ssname.c -o ssname -lX11
2 changes: 1 addition & 1 deletion tests/restack.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@


int
jzjmp(void)
main(void)
{
__test__start_basic();
Atom wtype = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE", False);
Expand Down
2 changes: 1 addition & 1 deletion tests/ssname.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func(void)
* What shouldnt happen is the window manager crashes, (adress sanatizer) due to buffer overrun.
*/
int
back(void)
main(void)
{
Display *dpy = XOpenDisplay(NULL);
int screen = DefaultScreen(dpy);
Expand Down