First unit tests for scheduler
This commit is contained in:
parent
6c7a46d3cd
commit
0319676d7e
20
Makefile
20
Makefile
|
@ -27,7 +27,15 @@ DEBDIR=debian
|
|||
OBJ=$(BINDIR)/scheduler.o $(BINDIR)/server.o $(BINDIR)/localworker.o $(BINDIR)/main.o
|
||||
|
||||
.DEFAULT_GOAL:= all
|
||||
.PHONY: all clean deb
|
||||
.PHONY: all clean deb tests install run
|
||||
|
||||
# ---- Tests enumeration ----------------------------------------------------- #
|
||||
TEST_SCHEDULER=$(BINDIR)/tests/scheduler
|
||||
TESTS=$(TEST_SCHEDULER)
|
||||
|
||||
$(BINDIR)/tests/scheduler: $(SRCDIR)/tests/scheduler.c
|
||||
@echo "Compiling $<"
|
||||
@$(CC) $(CCINCLUDES) $(CCOPTS) $(CCFLAGS) $(LDFLAGS) -o $@ $<
|
||||
|
||||
# ---- General recipes ------------------------------------------------------- #
|
||||
|
||||
|
@ -43,9 +51,11 @@ $(BINDIR)/gem-graph-server: $(OBJ)
|
|||
|
||||
# ---- Misc recipes ---------------------------------------------------------- #
|
||||
clean:
|
||||
rm -rf $(SRCDIR)/*.o $(BINDIR)/* *.deb
|
||||
-rm -f $(SRCDIR)/*.o $(BINDIR)/* $(BINDIR)/tests/* *.deb
|
||||
|
||||
all: $(DYNLIBS) $(BINDIR)/gem-graph-server
|
||||
all: $(BINDIR)/gem-graph-server
|
||||
|
||||
tests: $(TESTS)
|
||||
|
||||
# ---- Build debian package -------------------------------------------------- #
|
||||
$(BINDIR)/gem-graph-server.deb: all
|
||||
|
@ -63,6 +73,8 @@ install:
|
|||
echo "Installing is not supported"
|
||||
|
||||
# ---- Builder uses this target to run your application ---------------------- #
|
||||
run:
|
||||
run: all
|
||||
bin/gem-graph-server
|
||||
run-tests: tests
|
||||
bin/tests/scheduler
|
||||
|
||||
|
|
11
README.md
11
README.md
|
@ -1,2 +1,13 @@
|
|||
# gem-graph-server
|
||||
|
||||
Build & execute the program:
|
||||
```
|
||||
make
|
||||
make run
|
||||
```
|
||||
|
||||
Build & execute tests
|
||||
```
|
||||
make tests
|
||||
make run-tests
|
||||
```
|
||||
|
|
|
@ -50,6 +50,7 @@ static inline void centerAssign(Center_t *center, int x, int y, int z)
|
|||
|
||||
static inline Center_t *centerAdd(Center_t *anyCenter, Center_t *newCenter)
|
||||
{
|
||||
if (!newCenter) return NULL;
|
||||
if (anyCenter->next) {
|
||||
anyCenter->next->prev = newCenter;
|
||||
}
|
||||
|
@ -62,10 +63,9 @@ static inline Center_t *centerAdd(Center_t *anyCenter, Center_t *newCenter)
|
|||
|
||||
static inline void centerRemove(Center_t *oldCenter)
|
||||
{
|
||||
oldCenter->prev->next = oldCenter->next;
|
||||
oldCenter->next->prev = oldCenter->prev;
|
||||
|
||||
free(oldCenter);
|
||||
if (!oldCenter) return;
|
||||
if (oldCenter->prev) oldCenter->prev->next = oldCenter->next;
|
||||
if (oldCenter->next) oldCenter->next->prev = oldCenter->prev;
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------- //
|
||||
|
|
|
@ -1,22 +0,0 @@
|
|||
//=-------------------------------------------------------------------------=//
|
||||
// Local worker tests //
|
||||
// //
|
||||
// Copyright © 2021 The Gem-graph Project //
|
||||
// //
|
||||
// This file is part of gem-graph. //
|
||||
// //
|
||||
// This program is free software: you can redistribute it and/or modify //
|
||||
// it under the terms of the GNU Affero General Public License as //
|
||||
// published by the Free Software Foundation, either version 3 of the //
|
||||
// License, or (at your option) any later version. //
|
||||
// //
|
||||
// This program is distributed in the hope that it will be useful, //
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
||||
// GNU Affero General Public License for more details. //
|
||||
// //
|
||||
// You should have received a copy of the GNU Affero General Public License //
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>. //
|
||||
//=-------------------------------------------------------------------------=//
|
||||
|
||||
#include "../localworker.c"
|
|
@ -1,22 +0,0 @@
|
|||
//=-------------------------------------------------------------------------=//
|
||||
// Scheduler tests //
|
||||
// //
|
||||
// Copyright © 2021 The Gem-graph Project //
|
||||
// //
|
||||
// This file is part of gem-graph. //
|
||||
// //
|
||||
// This program is free software: you can redistribute it and/or modify //
|
||||
// it under the terms of the GNU Affero General Public License as //
|
||||
// published by the Free Software Foundation, either version 3 of the //
|
||||
// License, or (at your option) any later version. //
|
||||
// //
|
||||
// This program is distributed in the hope that it will be useful, //
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
||||
// GNU Affero General Public License for more details. //
|
||||
// //
|
||||
// You should have received a copy of the GNU Affero General Public License //
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>. //
|
||||
//=-------------------------------------------------------------------------=//
|
||||
|
||||
#include "../scheduler.c"
|
|
@ -1,22 +0,0 @@
|
|||
//=-------------------------------------------------------------------------=//
|
||||
// Server tests //
|
||||
// //
|
||||
// Copyright © 2021 The Gem-graph Project //
|
||||
// //
|
||||
// This file is part of gem-graph. //
|
||||
// //
|
||||
// This program is free software: you can redistribute it and/or modify //
|
||||
// it under the terms of the GNU Affero General Public License as //
|
||||
// published by the Free Software Foundation, either version 3 of the //
|
||||
// License, or (at your option) any later version. //
|
||||
// //
|
||||
// This program is distributed in the hope that it will be useful, //
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
||||
// GNU Affero General Public License for more details. //
|
||||
// //
|
||||
// You should have received a copy of the GNU Affero General Public License //
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>. //
|
||||
//=-------------------------------------------------------------------------=//
|
||||
|
||||
#include "../server.c"
|
Loading…
Reference in New Issue