mirror of https://github.com/rusefi/isotp-c.git
Initial commit with blank structure.
This commit is contained in:
commit
9dafed6b7f
|
@ -0,0 +1,5 @@
|
||||||
|
# ISO 15765-2 Support Library in C
|
||||||
|
|
||||||
|
## v0.1
|
||||||
|
|
||||||
|
* Initial release
|
|
@ -0,0 +1,24 @@
|
||||||
|
Copyright (c) 2013 Ford Motor Company
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions are met:
|
||||||
|
* Redistributions of source code must retain the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer.
|
||||||
|
* Redistributions in binary form must reproduce the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer in the
|
||||||
|
documentation and/or other materials provided with the distribution.
|
||||||
|
* Neither the name of the <organization> nor the
|
||||||
|
names of its contributors may be used to endorse or promote products
|
||||||
|
derived from this software without specific prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
|
||||||
|
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@ -0,0 +1,36 @@
|
||||||
|
CC = gcc
|
||||||
|
INCLUDES = -Isrc
|
||||||
|
CFLAGS = $(INCLUDES) -c -w -Wall -Werror -g -ggdb
|
||||||
|
LDFLAGS =
|
||||||
|
LDLIBS = -lcheck
|
||||||
|
|
||||||
|
TEST_DIR = tests
|
||||||
|
|
||||||
|
# Guard against \r\n line endings only in Cygwin
|
||||||
|
OSTYPE := $(shell uname)
|
||||||
|
ifneq ($(OSTYPE),Darwin)
|
||||||
|
OSTYPE := $(shell uname -o)
|
||||||
|
ifeq ($(OSTYPE),Cygwin)
|
||||||
|
TEST_SET_OPTS = igncr
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
SRC = $(wildcard src/**/*.c)
|
||||||
|
OBJS = $(SRC:.c=.o)
|
||||||
|
TEST_SRC = $(wildcard $(TEST_DIR)/*.c)
|
||||||
|
TEST_OBJS = $(TEST_SRC:.c=.o)
|
||||||
|
TESTS=$(patsubst %.c,%.bin,$(TEST_SRC))
|
||||||
|
|
||||||
|
all: $(OBJS)
|
||||||
|
|
||||||
|
test: $(TESTS)
|
||||||
|
@set -o $(TEST_SET_OPTS) >/dev/null 2>&1
|
||||||
|
@export SHELLOPTS
|
||||||
|
@sh runtests.sh $(TEST_DIR)
|
||||||
|
|
||||||
|
$(TEST_DIR)/%.bin: $(TEST_DIR)/%.o $(OBJS)
|
||||||
|
@mkdir -p $(dir $@)
|
||||||
|
$(CC) $(LDFLAGS) $(CC_SYMBOLS) $(INCLUDES) -o $@ $^ $(LDLIBS)
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -rf **/*.o $(TEST_DIR)/*.bin
|
|
@ -0,0 +1,18 @@
|
||||||
|
ISO 15765-2 Support Library in C
|
||||||
|
============
|
||||||
|
|
||||||
|
## Testing
|
||||||
|
|
||||||
|
The library includes a test suite that uses the `check` C unit test library.
|
||||||
|
|
||||||
|
$ make test
|
||||||
|
|
||||||
|
## Authors
|
||||||
|
|
||||||
|
Chris Peplin cpeplin@ford.com
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
Copyright (c) 2013 Ford Motor Company
|
||||||
|
|
||||||
|
Licensed under the BSD license.
|
|
@ -0,0 +1,17 @@
|
||||||
|
echo "Running unit tests:"
|
||||||
|
|
||||||
|
for i in $1/*.bin
|
||||||
|
do
|
||||||
|
if test -f $i
|
||||||
|
then
|
||||||
|
if ./$i
|
||||||
|
then
|
||||||
|
echo $i PASS
|
||||||
|
else
|
||||||
|
echo "ERROR in test $i:"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "${txtbld}$(tput setaf 2)All unit tests passed.$(tput sgr0)"
|
|
@ -0,0 +1,30 @@
|
||||||
|
#include <check.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <bitfield/bitfield.h>
|
||||||
|
|
||||||
|
START_TEST (test_fail)
|
||||||
|
{
|
||||||
|
fail_if(true);
|
||||||
|
}
|
||||||
|
END_TEST
|
||||||
|
|
||||||
|
Suite* bitfieldSuite(void) {
|
||||||
|
Suite* s = suite_create("iso15765");
|
||||||
|
TCase *tc_core = tcase_create("core");
|
||||||
|
tcase_add_test(tc_core, test_fail);
|
||||||
|
suite_add_tcase(s, tc_core);
|
||||||
|
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(void) {
|
||||||
|
int numberFailed;
|
||||||
|
Suite* s = bitfieldSuite();
|
||||||
|
SRunner *sr = srunner_create(s);
|
||||||
|
// Don't fork so we can actually use gdb
|
||||||
|
srunner_set_fork_status(sr, CK_NOFORK);
|
||||||
|
srunner_run_all(sr, CK_NORMAL);
|
||||||
|
numberFailed = srunner_ntests_failed(sr);
|
||||||
|
srunner_free(sr);
|
||||||
|
return (numberFailed == 0) ? 0 : 1;
|
||||||
|
}
|
Loading…
Reference in New Issue