mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2024-11-22 07:09:54 +00:00
Fix manual noverlay tests
* test/manual/noverlay/Makefile.in: Add copyright notice. (LIBS): Rename... (PACKAGES): ...to this, to avoid confusion with Autoconf's LIBS. All uses changed. (CFLAGS): Break out -I flag... (CPPFLAGS): ...into this new variable. (LDFLAGS): Rename... (LDLIBS): ...to this, which is expected to hold -l flags. (top_builddir): New variable. (EMACS): Define in terms of it. (.PHONY): Add clean, distclean, and perf targets. (have-libcheck): Remove redundant target. All uses updated. (itree-tests.o): Remove redundant dependency on its source file. (itree-tests): Remove redundant (and uncompilable) rule. * test/manual/noverlay/check-sanitize.sh: Use /usr/bin/env. Add copyright notice. Enable pipefail option, to propagate itree-tests exit status to caller. Fix typo in usage message. Strip less information from Check's error messages. * test/manual/noverlay/emacs-compat.h: Add copyright notice. Include stdlib.h. (emacs_abort, eassert): Consistently use EXIT_FAILURE. (eassume): Define when necessary. * test/manual/noverlay/itree-tests.c: Add copyright notice. Include standard headers before third-party ones. Use most narrowly applicable ck_assert* macro for the types being checked, e.g. ck_assert_ptr_* macros for pointer values. Replace removed names and APIs with current ones, e.g. the itree_node field 'color' is now called 'red'. Ensure preconditions of itree API are satisfied before use, e.g. itree_node otick being set appropriately before insertion, or global iterator being initialized before (implicit) use (bug#58976). Make all functions static. (DEF_TEST_SETUP): Remove all instances, replacing with... (test_insert1_setup, test_insert2_setup, test_remove1_setup) (test_remove2_setup): ...these new test fixtures. (A, B, C, D, E, N_05, N_10, N_15, N_20, N_30, N_40, N_50, N_70) (N_80, N_90, N_85, N_95): Define as static variables rather than macros. (test_get_tree4): Remove, inlining salient parts. (shuffle): Move closer to users. (test_create_tree): Accept itree_nodes as argument instead of dynamically allocating them. All callers changed. (FOREACH): Remove unused macro. (N_BEG, N_END): Define in terms of itree_node_begin and itree_node_end, respectively. (test_gap_insert_1, test_gap_insert_2, test_gap_insert_3) (test_gap_insert_5, test_gap_insert_7, test_gap_insert_11): Use test_setup_gap_node_noadvance. (basic_suite): Group unit tests into test cases and fixtures. Run previously forgotten test_insert_14. (main): Run suite as CK_ENV to allow specifying desired verbosity in the environment.
This commit is contained in:
parent
01471b5fdf
commit
fd3f51b7c3
@ -1,26 +1,41 @@
|
||||
### @configure_input@
|
||||
|
||||
# Copyright (C) 2017-2022 Free Software Foundation, Inc.
|
||||
|
||||
# This file is part of GNU Emacs.
|
||||
|
||||
# GNU Emacs is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
|
||||
# GNU Emacs 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 General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
PROGRAM = itree-tests
|
||||
LIBS = check
|
||||
PACKAGES = check
|
||||
top_srcdir = @top_srcdir@
|
||||
CFLAGS += -O0 -g3 $(shell pkg-config --cflags $(LIBS)) -I $(top_srcdir)/src
|
||||
LDFLAGS += $(shell pkg-config --libs $(LIBS)) -lm
|
||||
top_builddir = @top_builddir@
|
||||
CPPFLAGS += -I $(top_srcdir)/src
|
||||
CFLAGS += -O0 -g3 $(shell pkg-config --cflags $(PACKAGES))
|
||||
LDLIBS += $(shell pkg-config --libs $(PACKAGES)) -lm
|
||||
OBJECTS = itree-tests.o
|
||||
CC = gcc
|
||||
EMACS ?= ../../../src/emacs
|
||||
EMACS ?= $(top_builddir)/src/emacs
|
||||
|
||||
.PHONY: all check have-libcheck
|
||||
.PHONY: all check clean distclean perf
|
||||
|
||||
all: check
|
||||
|
||||
have-libcheck:
|
||||
pkg-config --cflags $(LIBS)
|
||||
|
||||
check: have-libcheck $(PROGRAM)
|
||||
check: $(PROGRAM)
|
||||
./check-sanitize.sh ./$(PROGRAM)
|
||||
|
||||
itree-tests.o: emacs-compat.h itree-tests.c $(top_srcdir)/src/itree.c $(top_srcdir)/src/itree.h
|
||||
|
||||
$(PROGRAM): $(OBJECTS)
|
||||
$(CC) $(CFLAGS) $(LDFLAGS) $(OBJECTS) -o $(PROGRAM)
|
||||
itree-tests.o: emacs-compat.h $(top_srcdir)/src/itree.c $(top_srcdir)/src/itree.h
|
||||
|
||||
perf:
|
||||
-$(EMACS) -Q -l ./overlay-perf.el -f perf-run-batch
|
||||
|
@ -1,11 +1,33 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
### check-sanitize.sh - strip confusing parts of Check error output
|
||||
|
||||
## Copyright (C) 2017-2022 Free Software Foundation, Inc.
|
||||
|
||||
## This file is part of GNU Emacs.
|
||||
|
||||
## GNU Emacs is free software: you can redistribute it and/or modify
|
||||
## it under the terms of the GNU General Public License as published by
|
||||
## the Free Software Foundation, either version 3 of the License, or
|
||||
## (at your option) any later version.
|
||||
|
||||
## GNU Emacs 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 General Public License for more details.
|
||||
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
set -o pipefail
|
||||
|
||||
prog=$1
|
||||
shift
|
||||
|
||||
[ -z "$prog" ] && {
|
||||
echo "usage:$(basename $0) CHECK_PRGOGRAM";
|
||||
echo "usage:$(basename $0) CHECK_PROGRAM";
|
||||
exit 1;
|
||||
}
|
||||
|
||||
"$prog" "$@" | sed -e 's/^\([^:]\+\):\([0-9]\+\):[PFE]:[^:]*:\([^:]*\):[^:]*: *\(.*\)/\1:\2:\3:\4/'
|
||||
# FIXME: This would be unnecessary if
|
||||
# compilation-error-regexp-alist-alist understood libcheck OOTB.
|
||||
"$prog" "$@" | sed -e 's/^\([^:]\+\):\([0-9]\+\):\([PFE]\):\([^:]*\):\([^:]*\):[^:]*:\(.*\)/\1:\2:\3:\4:\5:\6/'
|
||||
|
@ -1,8 +1,28 @@
|
||||
/* Mock necessary parts of lisp.h.
|
||||
|
||||
Copyright (C) 2017-2022 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Emacs.
|
||||
|
||||
GNU Emacs is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or (at
|
||||
your option) any later version.
|
||||
|
||||
GNU Emacs 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 General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef TEST_COMPAT_H
|
||||
#define TEST_COMPAT_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include <limits.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
typedef int Lisp_Object;
|
||||
|
||||
@ -28,20 +48,24 @@ void
|
||||
emacs_abort ()
|
||||
{
|
||||
fprintf (stderr, "Aborting...\n");
|
||||
exit (1);
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
|
||||
#ifndef eassert
|
||||
#define eassert(cond) \
|
||||
do { \
|
||||
if (! (cond)) { \
|
||||
fprintf (stderr, "\n%s:%d:eassert condition failed: %s\n", \
|
||||
__FILE__, __LINE__ ,#cond); \
|
||||
exit (1); \
|
||||
fprintf (stderr, "%s:%d:eassert condition failed: %s\n", \
|
||||
__FILE__, __LINE__ , # cond); \
|
||||
exit (EXIT_FAILURE); \
|
||||
} \
|
||||
} while (0)
|
||||
#endif
|
||||
|
||||
#ifndef eassume
|
||||
#define eassume eassert
|
||||
#endif
|
||||
|
||||
#ifndef max
|
||||
#define max(x,y) ((x) >= (y) ? (x) : (y))
|
||||
#endif
|
||||
@ -49,4 +73,4 @@ emacs_abort ()
|
||||
#define min(x,y) ((x) <= (y) ? (x) : (y))
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#endif /* TEST_COMPAT_H */
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user