mirror of
				https://gitlab.com/sortix/sortix.git
				synced 2023-02-13 20:55:38 -05:00 
			
		
		
		
	Convert regress to C.
This commit is contained in:
		
							parent
							
								
									9ea3edf36f
								
							
						
					
					
						commit
						8d58033846
					
				
					 11 changed files with 31 additions and 21 deletions
				
			
		
							
								
								
									
										2
									
								
								regress/.gitignore
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								regress/.gitignore
									
										
									
									
										vendored
									
									
								
							| 
						 | 
				
			
			@ -1,3 +1,3 @@
 | 
			
		|||
regress
 | 
			
		||||
test-*
 | 
			
		||||
!test-*.c++
 | 
			
		||||
!test-*.c
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -5,11 +5,11 @@ include ../build-aux/version.mak
 | 
			
		|||
include ../build-aux/dirs.mak
 | 
			
		||||
 | 
			
		||||
OPTLEVEL?=$(DEFAULT_OPTLEVEL)
 | 
			
		||||
CXXFLAGS?=$(OPTLEVEL)
 | 
			
		||||
CFLAGS?=$(OPTLEVEL)
 | 
			
		||||
TESTDIR?=$(LIBEXECDIR)/test
 | 
			
		||||
 | 
			
		||||
CPPFLAGS:=$(CPPFLAGS) -DVERSIONSTR=\"$(VERSION)\" -DTESTDIR=\"$(TESTDIR)\"
 | 
			
		||||
CXXFLAGS:=$(CXXFLAGS) -Wall -Wextra -fno-exceptions -fno-rtti
 | 
			
		||||
CFLAGS:=$(CFLAGS) -Wall -Wextra
 | 
			
		||||
 | 
			
		||||
BINARIES:=\
 | 
			
		||||
regress \
 | 
			
		||||
| 
						 | 
				
			
			@ -36,8 +36,8 @@ ifneq ($(TESTS),)
 | 
			
		|||
	install $(TESTS) $(DESTDIR)$(TESTDIR)
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
%: %.c++
 | 
			
		||||
	$(CXX) -std=gnu++11 $(CPPFLAGS) $(CXXFLAGS) $< -o $@
 | 
			
		||||
%: %.c
 | 
			
		||||
	$(CC) -std=gnu11 $(CFLAGS) $(CPPFLAGS) $< -o $@
 | 
			
		||||
 | 
			
		||||
clean:
 | 
			
		||||
	rm -f $(BINARIES) $(TESTS) *.o
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -15,7 +15,7 @@
 | 
			
		|||
    You should have received a copy of the GNU General Public License along with
 | 
			
		||||
    this program. If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 | 
			
		||||
    regress.c++
 | 
			
		||||
    regress.c
 | 
			
		||||
    Automatically invokes system tests.
 | 
			
		||||
 | 
			
		||||
*******************************************************************************/
 | 
			
		||||
| 
						 | 
				
			
			@ -26,6 +26,7 @@
 | 
			
		|||
#include <errno.h>
 | 
			
		||||
#include <error.h>
 | 
			
		||||
#include <fcntl.h>
 | 
			
		||||
#include <stdbool.h>
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
#include <stdlib.h>
 | 
			
		||||
#include <string.h>
 | 
			
		||||
| 
						 | 
				
			
			@ -48,7 +49,7 @@ bool is_usable_terminal(int fd)
 | 
			
		|||
	       10 <= ws.ws_col;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void tenth_last_column()
 | 
			
		||||
void tenth_last_column(void)
 | 
			
		||||
{
 | 
			
		||||
	struct wincurpos wcp;
 | 
			
		||||
	struct winsize ws;
 | 
			
		||||
| 
						 | 
				
			
			@ -153,7 +154,8 @@ int main(int argc, char* argv[])
 | 
			
		|||
			break;
 | 
			
		||||
		if ( arg[1] != '-' )
 | 
			
		||||
		{
 | 
			
		||||
			while ( char c = *++arg ) switch ( c )
 | 
			
		||||
			char c;
 | 
			
		||||
			while ( (c = *++arg) ) switch ( c )
 | 
			
		||||
			{
 | 
			
		||||
			case 'b': buffered = true; break;
 | 
			
		||||
			case 'q': verbosity--; break;
 | 
			
		||||
| 
						 | 
				
			
			@ -15,7 +15,7 @@
 | 
			
		|||
    You should have received a copy of the GNU General Public License along with
 | 
			
		||||
    this program. If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 | 
			
		||||
    test-fmemopen.c++
 | 
			
		||||
    test-fmemopen.c
 | 
			
		||||
    Tests basic fmemopen() usage.
 | 
			
		||||
 | 
			
		||||
*******************************************************************************/
 | 
			
		||||
| 
						 | 
				
			
			@ -15,7 +15,7 @@
 | 
			
		|||
    You should have received a copy of the GNU General Public License along with
 | 
			
		||||
    this program. If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 | 
			
		||||
    test-pthread-argv.c++
 | 
			
		||||
    test-pthread-argv.c
 | 
			
		||||
    Tests if the argument vector and environment dies with the main thread.
 | 
			
		||||
 | 
			
		||||
*******************************************************************************/
 | 
			
		||||
| 
						 | 
				
			
			@ -31,8 +31,10 @@ char** global_argv;
 | 
			
		|||
char** global_envp;
 | 
			
		||||
size_t answer = 0;
 | 
			
		||||
 | 
			
		||||
void* thread_routine(void*)
 | 
			
		||||
void* thread_routine(void* ctx)
 | 
			
		||||
{
 | 
			
		||||
	(void) ctx;
 | 
			
		||||
 | 
			
		||||
	int errnum;
 | 
			
		||||
 | 
			
		||||
	if ( (errnum = pthread_join(main_thread, NULL)) )
 | 
			
		||||
| 
						 | 
				
			
			@ -49,8 +51,10 @@ void* thread_routine(void*)
 | 
			
		|||
	exit(0);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int main(int /*argc*/, char* argv[], char* envp[])
 | 
			
		||||
int main(int argc, char* argv[], char* envp[])
 | 
			
		||||
{
 | 
			
		||||
	(void) argc;
 | 
			
		||||
 | 
			
		||||
	int errnum;
 | 
			
		||||
 | 
			
		||||
	for ( int i = 0; argv[i]; i++ )
 | 
			
		||||
| 
						 | 
				
			
			@ -15,7 +15,7 @@
 | 
			
		|||
    You should have received a copy of the GNU General Public License along with
 | 
			
		||||
    this program. If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 | 
			
		||||
    test-pthread-basic.c++
 | 
			
		||||
    test-pthread-basic.c
 | 
			
		||||
    Tests whether basic pthread support works.
 | 
			
		||||
 | 
			
		||||
*******************************************************************************/
 | 
			
		||||
| 
						 | 
				
			
			@ -15,7 +15,7 @@
 | 
			
		|||
    You should have received a copy of the GNU General Public License along with
 | 
			
		||||
    this program. If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 | 
			
		||||
    test-pthread-main-join.c++
 | 
			
		||||
    test-pthread-main-join.c
 | 
			
		||||
    Tests whether the main thread can be joined.
 | 
			
		||||
 | 
			
		||||
*******************************************************************************/
 | 
			
		||||
| 
						 | 
				
			
			@ -15,7 +15,7 @@
 | 
			
		|||
    You should have received a copy of the GNU General Public License along with
 | 
			
		||||
    this program. If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 | 
			
		||||
    test-pthread-once.c++
 | 
			
		||||
    test-pthread-once.c
 | 
			
		||||
    Tests whether basic pthread_once() support works.
 | 
			
		||||
 | 
			
		||||
*******************************************************************************/
 | 
			
		||||
| 
						 | 
				
			
			@ -27,13 +27,15 @@
 | 
			
		|||
static int init_counter = 0;
 | 
			
		||||
static pthread_once_t init_counter_once = PTHREAD_ONCE_INIT;
 | 
			
		||||
 | 
			
		||||
void init_counter_increase()
 | 
			
		||||
void init_counter_increase(void)
 | 
			
		||||
{
 | 
			
		||||
	init_counter++;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void* thread_routine(void*)
 | 
			
		||||
void* thread_routine(void* ctx)
 | 
			
		||||
{
 | 
			
		||||
	(void) ctx;
 | 
			
		||||
 | 
			
		||||
	pthread_once(&init_counter_once, init_counter_increase);
 | 
			
		||||
 | 
			
		||||
	return NULL;
 | 
			
		||||
| 
						 | 
				
			
			@ -15,7 +15,7 @@
 | 
			
		|||
    You should have received a copy of the GNU General Public License along with
 | 
			
		||||
    this program. If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 | 
			
		||||
    test-pthread-self.c++
 | 
			
		||||
    test-pthread-self.c
 | 
			
		||||
    Tests whether basic pthread_self() support works.
 | 
			
		||||
 | 
			
		||||
*******************************************************************************/
 | 
			
		||||
| 
						 | 
				
			
			@ -15,7 +15,7 @@
 | 
			
		|||
    You should have received a copy of the GNU General Public License along with
 | 
			
		||||
    this program. If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 | 
			
		||||
    test-pthread-tls.c++
 | 
			
		||||
    test-pthread-tls.c
 | 
			
		||||
    Tests whether basic tls support works.
 | 
			
		||||
 | 
			
		||||
*******************************************************************************/
 | 
			
		||||
| 
						 | 
				
			
			@ -26,8 +26,10 @@
 | 
			
		|||
 | 
			
		||||
__thread int tls_variable = 42;
 | 
			
		||||
 | 
			
		||||
void* thread_routine(void*)
 | 
			
		||||
void* thread_routine(void* ctx)
 | 
			
		||||
{
 | 
			
		||||
	(void) ctx;
 | 
			
		||||
 | 
			
		||||
	test_assert(tls_variable == 42);
 | 
			
		||||
 | 
			
		||||
	tls_variable = 9001;
 | 
			
		||||
| 
						 | 
				
			
			@ -15,7 +15,7 @@
 | 
			
		|||
    You should have received a copy of the GNU General Public License along with
 | 
			
		||||
    this program. If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 | 
			
		||||
    test-signal-raise.c++
 | 
			
		||||
    test-signal-raise.c
 | 
			
		||||
    Tests whether basic raise() support works.
 | 
			
		||||
 | 
			
		||||
*******************************************************************************/
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue