mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-01-31 03:27:39 +00:00
Stop using .com extension in monorepo
The WIN32 CreateProcess() function does not require an .exe or .com suffix in order to spawn an executable. Now that we have Cosmo bash we're no longer so dependent on the cmd.exe prompt.
This commit is contained in:
parent
c8383f25b4
commit
a6baba1b07
239 changed files with 2092 additions and 2244 deletions
94
Makefile
94
Makefile
|
@ -21,23 +21,23 @@
|
||||||
# make -j8 -O MODE=tiny
|
# make -j8 -O MODE=tiny
|
||||||
#
|
#
|
||||||
# # build individual target
|
# # build individual target
|
||||||
# make -j8 -O o//examples/hello.com
|
# make -j8 -O o//examples/hello
|
||||||
# o//examples/hello.com
|
# o//examples/hello
|
||||||
#
|
#
|
||||||
# # view source
|
# # view source
|
||||||
# less examples/hello.c
|
# less examples/hello.c
|
||||||
#
|
#
|
||||||
# # view binary
|
# # view binary
|
||||||
# o//tool/viz/bing.com o//examples/hello.com |
|
# o//tool/viz/bing o//examples/hello |
|
||||||
# o//tool/viz/fold.com
|
# o//tool/viz/fold
|
||||||
#
|
#
|
||||||
# # view transitive closure of legalese
|
# # view transitive closure of legalese
|
||||||
# o//tool/viz/bing.com -n o//examples/hello.com |
|
# o//tool/viz/bing -n o//examples/hello |
|
||||||
# o//tool/viz/fold.com
|
# o//tool/viz/fold
|
||||||
#
|
#
|
||||||
# # basic debugging
|
# # basic debugging
|
||||||
# make -j8 -O MODE=dbg o/dbg/examples/crashreport.com
|
# make -j8 -O MODE=dbg o/dbg/examples/crashreport
|
||||||
# o/examples/crashreport.com
|
# o/examples/crashreport
|
||||||
# less examples/crashreport.c
|
# less examples/crashreport.c
|
||||||
#
|
#
|
||||||
# # extremely tiny binaries
|
# # extremely tiny binaries
|
||||||
|
@ -51,7 +51,7 @@
|
||||||
#
|
#
|
||||||
# TROUBLESHOOTING
|
# TROUBLESHOOTING
|
||||||
#
|
#
|
||||||
# make -j8 -O V=1 o//examples/hello.com
|
# make -j8 -O V=1 o//examples/hello
|
||||||
# make o//examples/life.elf -pn |& less
|
# make o//examples/life.elf -pn |& less
|
||||||
# etc.
|
# etc.
|
||||||
#
|
#
|
||||||
|
@ -59,7 +59,7 @@
|
||||||
#
|
#
|
||||||
# build/config.mk
|
# build/config.mk
|
||||||
|
|
||||||
SHELL = build/bootstrap/cocmd.com
|
SHELL = build/bootstrap/cocmd
|
||||||
MAKEFLAGS += --no-builtin-rules
|
MAKEFLAGS += --no-builtin-rules
|
||||||
|
|
||||||
.SUFFIXES:
|
.SUFFIXES:
|
||||||
|
@ -77,8 +77,8 @@ COMMA := ,
|
||||||
PWD := $(shell pwd)
|
PWD := $(shell pwd)
|
||||||
|
|
||||||
# detect wsl2 running cosmopolitan binaries on the host by checking whether:
|
# detect wsl2 running cosmopolitan binaries on the host by checking whether:
|
||||||
# - user ran build/bootstrap/make.com, in which case make's working directory is in wsl
|
# - user ran build/bootstrap/make, in which case make's working directory is in wsl
|
||||||
# - user ran make, in which case cocmd.com's working directory is in wsl
|
# - user ran make, in which case cocmd's working directory is in wsl
|
||||||
ifneq ($(findstring //wsl.localhost/,$(CURDIR) $(PWD)),)
|
ifneq ($(findstring //wsl.localhost/,$(CURDIR) $(PWD)),)
|
||||||
$(warning wsl2 interop is enabled)
|
$(warning wsl2 interop is enabled)
|
||||||
$(error you need to run sudo sh -c 'echo -1 > /proc/sys/fs/binfmt_misc/WSLInterop')
|
$(error you need to run sudo sh -c 'echo -1 > /proc/sys/fs/binfmt_misc/WSLInterop')
|
||||||
|
@ -89,7 +89,7 @@ UNAME_S := $(shell uname -s)
|
||||||
|
|
||||||
# apple still distributes a 17 year old version of gnu make
|
# apple still distributes a 17 year old version of gnu make
|
||||||
ifeq ($(MAKE_VERSION), 3.81)
|
ifeq ($(MAKE_VERSION), 3.81)
|
||||||
$(error please use build/bootstrap/make.com)
|
$(error please use build/bootstrap/make)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
LC_ALL = C
|
LC_ALL = C
|
||||||
|
@ -101,21 +101,21 @@ XARGS ?= xargs -P4 -rs8000
|
||||||
DOT ?= dot
|
DOT ?= dot
|
||||||
CLANG = clang
|
CLANG = clang
|
||||||
TMPDIR = o/tmp
|
TMPDIR = o/tmp
|
||||||
AR = build/bootstrap/ar.com
|
AR = build/bootstrap/ar
|
||||||
CP = build/bootstrap/cp.com
|
CP = build/bootstrap/cp
|
||||||
RM = build/bootstrap/rm.com -f
|
RM = build/bootstrap/rm -f
|
||||||
GZIP = build/bootstrap/gzip.com
|
GZIP = build/bootstrap/gzip
|
||||||
ECHO = build/bootstrap/echo.com
|
ECHO = build/bootstrap/echo
|
||||||
CHMOD = build/bootstrap/chmod.com
|
CHMOD = build/bootstrap/chmod
|
||||||
TOUCH = build/bootstrap/touch.com
|
TOUCH = build/bootstrap/touch
|
||||||
PKG = build/bootstrap/package.com
|
PKG = build/bootstrap/package
|
||||||
MKDEPS = build/bootstrap/mkdeps.com
|
MKDEPS = build/bootstrap/mkdeps
|
||||||
ZIPOBJ = build/bootstrap/zipobj.com
|
ZIPOBJ = build/bootstrap/zipobj
|
||||||
ZIPCOPY = build/bootstrap/zipcopy.com
|
ZIPCOPY = build/bootstrap/zipcopy
|
||||||
PECHECK = build/bootstrap/pecheck.com
|
PECHECK = build/bootstrap/pecheck
|
||||||
FIXUPOBJ = build/bootstrap/fixupobj.com
|
FIXUPOBJ = build/bootstrap/fixupobj
|
||||||
MKDIR = build/bootstrap/mkdir.com -p
|
MKDIR = build/bootstrap/mkdir -p
|
||||||
COMPILE = build/bootstrap/compile.com -V9 -M2048m -P8192 $(QUOTA)
|
COMPILE = build/bootstrap/compile -V9 -M2048m -P8192 $(QUOTA)
|
||||||
|
|
||||||
IGNORE := $(shell $(MKDIR) $(TMPDIR))
|
IGNORE := $(shell $(MKDIR) $(TMPDIR))
|
||||||
|
|
||||||
|
@ -187,7 +187,7 @@ o/$(MODE): \
|
||||||
o/$(MODE)/: o/$(MODE)
|
o/$(MODE)/: o/$(MODE)
|
||||||
o/$(MODE)/.: o/$(MODE)
|
o/$(MODE)/.: o/$(MODE)
|
||||||
|
|
||||||
# check if we're using o//third_party/make/make.com
|
# check if we're using o//third_party/make/make
|
||||||
# we added sandboxing to guarantee cosmo's makefile is hermetic
|
# we added sandboxing to guarantee cosmo's makefile is hermetic
|
||||||
# it also shaves away 200ms of startup latency with native $(uniq)
|
# it also shaves away 200ms of startup latency with native $(uniq)
|
||||||
ifneq ($(LANDLOCKMAKE_VERSION),)
|
ifneq ($(LANDLOCKMAKE_VERSION),)
|
||||||
|
@ -415,17 +415,17 @@ o/$(MODE)/hdrs-old.txt: o/$(MODE)/.x $(MAKEFILES) $(call uniq,$(foreach x,$(HDRS
|
||||||
$(file >$@) $(foreach x,$(HDRS) $(INCS),$(file >>$@,$(x)))
|
$(file >$@) $(foreach x,$(HDRS) $(INCS),$(file >>$@,$(x)))
|
||||||
|
|
||||||
TAGS: private .UNSANDBOXED = 1
|
TAGS: private .UNSANDBOXED = 1
|
||||||
TAGS: o/$(MODE)/srcs-old.txt $(SRCS) #o/$(MODE)/third_party/ctags/ctags.com
|
TAGS: o/$(MODE)/srcs-old.txt $(SRCS) #o/$(MODE)/third_party/ctags/ctags
|
||||||
@$(RM) $@
|
@$(RM) $@
|
||||||
@o/$(MODE)/third_party/ctags/ctags.com $(TAGSFLAGS) -L $< -o $@
|
@o/$(MODE)/third_party/ctags/ctags $(TAGSFLAGS) -L $< -o $@
|
||||||
|
|
||||||
HTAGS: private .UNSANDBOXED = 1
|
HTAGS: private .UNSANDBOXED = 1
|
||||||
HTAGS: o/$(MODE)/hdrs-old.txt $(filter-out third_party/libcxx/%,$(HDRS)) #o/$(MODE)/third_party/ctags/ctags.com
|
HTAGS: o/$(MODE)/hdrs-old.txt $(filter-out third_party/libcxx/%,$(HDRS)) #o/$(MODE)/third_party/ctags/ctags
|
||||||
@$(RM) $@
|
@$(RM) $@
|
||||||
@build/htags o/$(MODE)/third_party/ctags/ctags.com -L $< -o $@
|
@build/htags o/$(MODE)/third_party/ctags/ctags -L $< -o $@
|
||||||
|
|
||||||
loc: private .UNSANDBOXED = 1
|
loc: private .UNSANDBOXED = 1
|
||||||
loc: o/$(MODE)/tool/build/summy.com
|
loc: o/$(MODE)/tool/build/summy
|
||||||
find -name \*.h -or -name \*.c -or -name \*.S | \
|
find -name \*.h -or -name \*.c -or -name \*.S | \
|
||||||
$(XARGS) wc -l | grep total | awk '{print $$1}' | $<
|
$(XARGS) wc -l | grep total | awk '{print $$1}' | $<
|
||||||
|
|
||||||
|
@ -550,16 +550,16 @@ o/cosmopolitan.h: o/cosmopolitan.h.txt \
|
||||||
$(wildcard libc/integral/*) \
|
$(wildcard libc/integral/*) \
|
||||||
$(foreach x,$(COSMOPOLITAN_H_PKGS),$($(x)_HDRS)) \
|
$(foreach x,$(COSMOPOLITAN_H_PKGS),$($(x)_HDRS)) \
|
||||||
$(foreach x,$(COSMOPOLITAN_H_PKGS),$($(x)_INCS))
|
$(foreach x,$(COSMOPOLITAN_H_PKGS),$($(x)_INCS))
|
||||||
@$(COMPILE) -AROLLUP -T$@ build/bootstrap/rollup.com @$< >>$@
|
@$(COMPILE) -AROLLUP -T$@ build/bootstrap/rollup @$< >>$@
|
||||||
|
|
||||||
o/cosmopolitan.html: private .UNSANDBOXED = 1
|
o/cosmopolitan.html: private .UNSANDBOXED = 1
|
||||||
o/cosmopolitan.html: \
|
o/cosmopolitan.html: \
|
||||||
o/$(MODE)/third_party/chibicc/chibicc.com.dbg \
|
o/$(MODE)/third_party/chibicc/chibicc.dbg \
|
||||||
$(filter-out %.s,$(foreach x,$(COSMOPOLITAN_OBJECTS),$($(x)_SRCS))) \
|
$(filter-out %.s,$(foreach x,$(COSMOPOLITAN_OBJECTS),$($(x)_SRCS))) \
|
||||||
$(filter-out %.cpp,$(filter-out %.cc,$(SRCS))) \
|
$(filter-out %.cpp,$(filter-out %.cc,$(SRCS))) \
|
||||||
$(HDRS)
|
$(HDRS)
|
||||||
$(file >$(TMPDIR)/$(subst /,_,$@),$(filter-out %.cpp,$(filter-out %.cc,$(filter-out %.s,$(foreach x,$(COSMOPOLITAN_OBJECTS),$($(x)_SRCS))))))
|
$(file >$(TMPDIR)/$(subst /,_,$@),$(filter-out %.cpp,$(filter-out %.cc,$(filter-out %.s,$(foreach x,$(COSMOPOLITAN_OBJECTS),$($(x)_SRCS))))))
|
||||||
o/$(MODE)/third_party/chibicc/chibicc.com.dbg -J \
|
o/$(MODE)/third_party/chibicc/chibicc.dbg -J \
|
||||||
-fno-common -include libc/integral/normalize.inc -o $@ \
|
-fno-common -include libc/integral/normalize.inc -o $@ \
|
||||||
-DCOSMO @$(TMPDIR)/$(subst /,_,$@)
|
-DCOSMO @$(TMPDIR)/$(subst /,_,$@)
|
||||||
|
|
||||||
|
@ -582,13 +582,13 @@ TOOLCHAIN_ARTIFACTS = \
|
||||||
o/$(MODE)/ape/ape-no-modify-self.o \
|
o/$(MODE)/ape/ape-no-modify-self.o \
|
||||||
o/$(MODE)/cosmopolitan.a \
|
o/$(MODE)/cosmopolitan.a \
|
||||||
o/$(MODE)/third_party/libcxx/libcxx.a \
|
o/$(MODE)/third_party/libcxx/libcxx.a \
|
||||||
o/$(MODE)/tool/build/march-native.com \
|
o/$(MODE)/tool/build/march-native \
|
||||||
o/$(MODE)/tool/build/ar.com \
|
o/$(MODE)/tool/build/ar \
|
||||||
o/$(MODE)/tool/build/mktemper.com \
|
o/$(MODE)/tool/build/mktemper \
|
||||||
o/$(MODE)/tool/build/fixupobj.com \
|
o/$(MODE)/tool/build/fixupobj \
|
||||||
o/$(MODE)/tool/build/zipcopy.com \
|
o/$(MODE)/tool/build/zipcopy \
|
||||||
o/$(MODE)/tool/build/apelink.com \
|
o/$(MODE)/tool/build/apelink \
|
||||||
o/$(MODE)/tool/build/pecheck.com
|
o/$(MODE)/tool/build/pecheck
|
||||||
else
|
else
|
||||||
TOOLCHAIN_ARTIFACTS = \
|
TOOLCHAIN_ARTIFACTS = \
|
||||||
o/$(MODE)/ape/ape.elf \
|
o/$(MODE)/ape/ape.elf \
|
||||||
|
@ -596,9 +596,9 @@ TOOLCHAIN_ARTIFACTS = \
|
||||||
o/$(MODE)/libc/crt/crt.o \
|
o/$(MODE)/libc/crt/crt.o \
|
||||||
o/$(MODE)/cosmopolitan.a \
|
o/$(MODE)/cosmopolitan.a \
|
||||||
o/$(MODE)/third_party/libcxx/libcxx.a \
|
o/$(MODE)/third_party/libcxx/libcxx.a \
|
||||||
o/$(MODE)/tool/build/march-native.com \
|
o/$(MODE)/tool/build/march-native \
|
||||||
o/$(MODE)/tool/build/fixupobj.com \
|
o/$(MODE)/tool/build/fixupobj \
|
||||||
o/$(MODE)/tool/build/zipcopy.com
|
o/$(MODE)/tool/build/zipcopy
|
||||||
endif
|
endif
|
||||||
|
|
||||||
.PHONY: toolchain
|
.PHONY: toolchain
|
||||||
|
|
|
@ -220,10 +220,10 @@ o/$(MODE)/ape/loader-xnu-clang.asm: ape/loader.c
|
||||||
@$(COMPILE) -AOBJECTIFY.c $(CLANG) -DSUPPORT_VECTOR=8 -S -g0 $(APE_LOADER_FLAGS)
|
@$(COMPILE) -AOBJECTIFY.c $(CLANG) -DSUPPORT_VECTOR=8 -S -g0 $(APE_LOADER_FLAGS)
|
||||||
|
|
||||||
o/$(MODE)/ape/ape.elf: o/$(MODE)/ape/ape.elf.dbg
|
o/$(MODE)/ape/ape.elf: o/$(MODE)/ape/ape.elf.dbg
|
||||||
@$(COMPILE) -AOBJBINCOPY -w build/bootstrap/objbincopy.com -f -o $@ $<
|
@$(COMPILE) -AOBJBINCOPY -w build/bootstrap/objbincopy -f -o $@ $<
|
||||||
|
|
||||||
o/$(MODE)/ape/ape.macho: o/$(MODE)/ape/ape.elf.dbg
|
o/$(MODE)/ape/ape.macho: o/$(MODE)/ape/ape.elf.dbg
|
||||||
@$(COMPILE) -AOBJBINCOPY -w build/bootstrap/objbincopy.com -fm -o $@ $<
|
@$(COMPILE) -AOBJBINCOPY -w build/bootstrap/objbincopy -fm -o $@ $<
|
||||||
|
|
||||||
APE_LOADER_LDFLAGS = \
|
APE_LOADER_LDFLAGS = \
|
||||||
-static \
|
-static \
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
#include "libc/macros.internal.h"
|
#include "libc/macros.internal.h"
|
||||||
|
|
||||||
// Apple Mach-O Executable Headers
|
// Apple Mach-O Executable Headers
|
||||||
// Fixups are applied by objbincopy.com
|
// Fixups are applied by objbincopy
|
||||||
// There must exist a MAC_LC_SEGMENT_64 for every PT_LOAD
|
// There must exist a MAC_LC_SEGMENT_64 for every PT_LOAD
|
||||||
|
|
||||||
.section .macho,"a",@progbits
|
.section .macho,"a",@progbits
|
||||||
|
|
|
@ -79,17 +79,17 @@ o/$(MODE)/%.pkg:
|
||||||
$(file >$(TMPSAFE).args,$(filter %.o,$^))
|
$(file >$(TMPSAFE).args,$(filter %.o,$^))
|
||||||
@$(COMPILE) -APACKAGE -wT$@ $(PKG) $(OUTPUT_OPTION) $(addprefix -d,$(filter %.pkg,$^)) @$(TMPSAFE).args
|
@$(COMPILE) -APACKAGE -wT$@ $(PKG) $(OUTPUT_OPTION) $(addprefix -d,$(filter %.pkg,$^)) @$(TMPSAFE).args
|
||||||
|
|
||||||
o/$(MODE)/%.o: %.py o/$(MODE)/third_party/python/pyobj.com
|
o/$(MODE)/%.o: %.py o/$(MODE)/third_party/python/pyobj
|
||||||
@$(COMPILE) -wAPYOBJ o/$(MODE)/third_party/python/pyobj.com $(PYFLAGS) -o $@ $<
|
@$(COMPILE) -wAPYOBJ o/$(MODE)/third_party/python/pyobj $(PYFLAGS) -o $@ $<
|
||||||
|
|
||||||
o/$(MODE)/%.pyc: %.py o/$(MODE)/third_party/python/pycomp.com
|
o/$(MODE)/%.pyc: %.py o/$(MODE)/third_party/python/pycomp
|
||||||
@$(COMPILE) -wAPYCOMP o/$(MODE)/third_party/python/pycomp.com $(PYCFLAGS) -o $@ $<
|
@$(COMPILE) -wAPYCOMP o/$(MODE)/third_party/python/pycomp $(PYCFLAGS) -o $@ $<
|
||||||
|
|
||||||
o/$(MODE)/%.lua: %.lua o/$(MODE)/third_party/lua/luac.com
|
o/$(MODE)/%.lua: %.lua o/$(MODE)/third_party/lua/luac
|
||||||
@$(COMPILE) -wALUAC o/$(MODE)/third_party/lua/luac.com -s -o $@ $<
|
@$(COMPILE) -wALUAC o/$(MODE)/third_party/lua/luac -s -o $@ $<
|
||||||
|
|
||||||
o/$(MODE)/%.lua.runs: %.lua o/$(MODE)/tool/net/redbean.com
|
o/$(MODE)/%.lua.runs: %.lua o/$(MODE)/tool/net/redbean
|
||||||
@$(COMPILE) -wALUA -tT$@ o/$(MODE)/tool/net/redbean.com $(LUAFLAGS) -i $<
|
@$(COMPILE) -wALUA -tT$@ o/$(MODE)/tool/net/redbean $(LUAFLAGS) -i $<
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# LOCAL UNIT TESTS
|
# LOCAL UNIT TESTS
|
||||||
|
@ -108,22 +108,22 @@ o/$(MODE)/%.lua.runs: %.lua o/$(MODE)/tool/net/redbean.com
|
||||||
#
|
#
|
||||||
# You could then run a command like:
|
# You could then run a command like:
|
||||||
#
|
#
|
||||||
# make -j8 o//test/libc/calls/openbsd_test.com.runs
|
# make -j8 o//test/libc/calls/openbsd_test.runs
|
||||||
#
|
#
|
||||||
# You need PROT_EXEC permission since ftrace morphs the binary. It's
|
# You need PROT_EXEC permission since ftrace morphs the binary. It's
|
||||||
# also worth mentioning that the pledge.com command can simulate what
|
# also worth mentioning that the pledge command can simulate what
|
||||||
# Landlock Make does:
|
# Landlock Make does:
|
||||||
#
|
#
|
||||||
# o//tool/build/pledge.com \
|
# o//tool/build/pledge \
|
||||||
# -v. -p 'stdio rpath wpath cpath tty prot_exec' \
|
# -v. -p 'stdio rpath wpath cpath tty prot_exec' \
|
||||||
# o//test/libc/calls/openbsd_test.com \
|
# o//test/libc/calls/openbsd_test \
|
||||||
# ----ftrace
|
# ----ftrace
|
||||||
#
|
#
|
||||||
# This is useful in the event a test binary should run by itself, but
|
# This is useful in the event a test binary should run by itself, but
|
||||||
# fails to run beneath Landlock Make. It's also useful sometimes to
|
# fails to run beneath Landlock Make. It's also useful sometimes to
|
||||||
# override the verbosity when running tests:
|
# override the verbosity when running tests:
|
||||||
#
|
#
|
||||||
# make V=5 TESTARGS=-b o//test/libc/calls/openbsd_test.com.runs
|
# make V=5 TESTARGS=-b o//test/libc/calls/openbsd_test.runs
|
||||||
#
|
#
|
||||||
# This way, if for some reason a test should fail but calls exit(0),
|
# This way, if for some reason a test should fail but calls exit(0),
|
||||||
# then the stdout/stderr output, which would normally be suppressed,
|
# then the stdout/stderr output, which would normally be suppressed,
|
||||||
|
@ -135,7 +135,7 @@ o/$(MODE)/%.runs: o/$(MODE)/%
|
||||||
################################################################################
|
################################################################################
|
||||||
# ELF ZIP FILES
|
# ELF ZIP FILES
|
||||||
#
|
#
|
||||||
# zipobj.com lets us do fast incremental linking of compressed data.
|
# zipobj lets us do fast incremental linking of compressed data.
|
||||||
# it's nice because if we link a hundred binaries that use the time zone
|
# it's nice because if we link a hundred binaries that use the time zone
|
||||||
# database, then that database only needs to be DEFLATE'd once.
|
# database, then that database only needs to be DEFLATE'd once.
|
||||||
|
|
||||||
|
@ -183,23 +183,6 @@ o/$(MODE)/%.okk: private .UNSANDBOXED = 1
|
||||||
o/$(MODE)/%.okk: %
|
o/$(MODE)/%.okk: %
|
||||||
@$(COMPILE) -ACHECK.h $(COMPILE.cxx) -xc++ -g0 -o $@ $<
|
@$(COMPILE) -ACHECK.h $(COMPILE.cxx) -xc++ -g0 -o $@ $<
|
||||||
|
|
||||||
################################################################################
|
|
||||||
# EXECUTABLE HELPERS
|
|
||||||
|
|
||||||
MAKE_SYMTAB_CREATE = \
|
|
||||||
$(COMPILE) -wASYMTAB \
|
|
||||||
o/$(MODE)/tool/build/symtab.com \
|
|
||||||
-o $(TMPSAFE)/.symtab \
|
|
||||||
$<
|
|
||||||
|
|
||||||
MAKE_SYMTAB_ZIP = \
|
|
||||||
$(COMPILE) -AZIP -T$@ \
|
|
||||||
o/$(MODE)/third_party/zip/zip.com \
|
|
||||||
-b$(TMPDIR) \
|
|
||||||
-9qj \
|
|
||||||
$@ \
|
|
||||||
$(TMPSAFE)/.symtab
|
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# EMACS ASSEMBLY GENERATION
|
# EMACS ASSEMBLY GENERATION
|
||||||
|
|
||||||
|
|
|
@ -14,130 +14,130 @@ EXAMPLES_MAINS_S = $(filter %.S,$(EXAMPLES_FILES))
|
||||||
EXAMPLES_MAINS_C = $(filter %.c,$(EXAMPLES_FILES))
|
EXAMPLES_MAINS_C = $(filter %.c,$(EXAMPLES_FILES))
|
||||||
EXAMPLES_MAINS_CC = $(filter %.cc,$(EXAMPLES_FILES))
|
EXAMPLES_MAINS_CC = $(filter %.cc,$(EXAMPLES_FILES))
|
||||||
|
|
||||||
EXAMPLES_SRCS = \
|
EXAMPLES_SRCS = \
|
||||||
$(EXAMPLES_MAINS_S) \
|
$(EXAMPLES_MAINS_S) \
|
||||||
$(EXAMPLES_MAINS_C) \
|
$(EXAMPLES_MAINS_C) \
|
||||||
$(EXAMPLES_MAINS_CC)
|
$(EXAMPLES_MAINS_CC)
|
||||||
|
|
||||||
EXAMPLES_MAINS = \
|
EXAMPLES_MAINS = \
|
||||||
$(EXAMPLES_MAINS_S) \
|
$(EXAMPLES_MAINS_S) \
|
||||||
$(EXAMPLES_MAINS_C) \
|
$(EXAMPLES_MAINS_C) \
|
||||||
$(EXAMPLES_MAINS_CC)
|
$(EXAMPLES_MAINS_CC)
|
||||||
|
|
||||||
EXAMPLES_OBJS = \
|
EXAMPLES_OBJS = \
|
||||||
$(EXAMPLES_MAINS_S:%.S=o/$(MODE)/%.o) \
|
$(EXAMPLES_MAINS_S:%.S=o/$(MODE)/%.o) \
|
||||||
$(EXAMPLES_MAINS_C:%.c=o/$(MODE)/%.o) \
|
$(EXAMPLES_MAINS_C:%.c=o/$(MODE)/%.o) \
|
||||||
$(EXAMPLES_MAINS_CC:%.cc=o/$(MODE)/%.o)
|
$(EXAMPLES_MAINS_CC:%.cc=o/$(MODE)/%.o)
|
||||||
|
|
||||||
EXAMPLES_COMS = \
|
EXAMPLES_COMS = \
|
||||||
$(EXAMPLES_MAINS_S:%.S=o/$(MODE)/%.com) \
|
$(EXAMPLES_MAINS_S:%.S=o/$(MODE)/%) \
|
||||||
$(EXAMPLES_MAINS_C:%.c=o/$(MODE)/%.com) \
|
$(EXAMPLES_MAINS_C:%.c=o/$(MODE)/%) \
|
||||||
$(EXAMPLES_MAINS_CC:%.cc=o/$(MODE)/%.com)
|
$(EXAMPLES_MAINS_CC:%.cc=o/$(MODE)/%)
|
||||||
|
|
||||||
EXAMPLES_BINS = \
|
EXAMPLES_BINS = \
|
||||||
$(EXAMPLES_COMS) \
|
$(EXAMPLES_COMS) \
|
||||||
$(EXAMPLES_COMS:%=%.dbg)
|
$(EXAMPLES_COMS:%=%.dbg)
|
||||||
|
|
||||||
EXAMPLES_DIRECTDEPS = \
|
EXAMPLES_DIRECTDEPS = \
|
||||||
DSP_CORE \
|
DSP_CORE \
|
||||||
DSP_SCALE \
|
DSP_SCALE \
|
||||||
DSP_TTY \
|
DSP_TTY \
|
||||||
LIBC_CALLS \
|
LIBC_CALLS \
|
||||||
LIBC_DLOPEN \
|
LIBC_DLOPEN \
|
||||||
LIBC_FMT \
|
LIBC_FMT \
|
||||||
LIBC_INTRIN \
|
LIBC_INTRIN \
|
||||||
LIBC_IRQ \
|
LIBC_IRQ \
|
||||||
LIBC_LOG \
|
LIBC_LOG \
|
||||||
LIBC_MEM \
|
LIBC_MEM \
|
||||||
LIBC_NEXGEN32E \
|
LIBC_NEXGEN32E \
|
||||||
LIBC_NT_ADVAPI32 \
|
LIBC_NT_ADVAPI32 \
|
||||||
LIBC_NT_IPHLPAPI \
|
LIBC_NT_IPHLPAPI \
|
||||||
LIBC_NT_KERNEL32 \
|
LIBC_NT_KERNEL32 \
|
||||||
LIBC_NT_NTDLL \
|
LIBC_NT_NTDLL \
|
||||||
LIBC_NT_USER32 \
|
LIBC_NT_USER32 \
|
||||||
LIBC_NT_WS2_32 \
|
LIBC_NT_WS2_32 \
|
||||||
LIBC_PROC \
|
LIBC_PROC \
|
||||||
LIBC_RUNTIME \
|
LIBC_RUNTIME \
|
||||||
LIBC_SOCK \
|
LIBC_SOCK \
|
||||||
LIBC_STDIO \
|
LIBC_STDIO \
|
||||||
LIBC_STR \
|
LIBC_STR \
|
||||||
LIBC_SYSV \
|
LIBC_SYSV \
|
||||||
LIBC_SYSV_CALLS \
|
LIBC_SYSV_CALLS \
|
||||||
LIBC_TESTLIB \
|
LIBC_TESTLIB \
|
||||||
LIBC_THREAD \
|
LIBC_THREAD \
|
||||||
LIBC_TIME \
|
LIBC_TIME \
|
||||||
LIBC_TINYMATH \
|
LIBC_TINYMATH \
|
||||||
LIBC_VGA \
|
LIBC_VGA \
|
||||||
LIBC_X \
|
LIBC_X \
|
||||||
NET_HTTP \
|
NET_HTTP \
|
||||||
NET_HTTPS \
|
NET_HTTPS \
|
||||||
THIRD_PARTY_AWK \
|
THIRD_PARTY_AWK \
|
||||||
THIRD_PARTY_COMPILER_RT \
|
THIRD_PARTY_COMPILER_RT \
|
||||||
THIRD_PARTY_DLMALLOC \
|
THIRD_PARTY_DLMALLOC \
|
||||||
THIRD_PARTY_DOUBLECONVERSION \
|
THIRD_PARTY_DOUBLECONVERSION \
|
||||||
THIRD_PARTY_GDTOA \
|
THIRD_PARTY_GDTOA \
|
||||||
THIRD_PARTY_GETOPT \
|
THIRD_PARTY_GETOPT \
|
||||||
THIRD_PARTY_HIREDIS \
|
THIRD_PARTY_HIREDIS \
|
||||||
THIRD_PARTY_LIBCXX \
|
THIRD_PARTY_LIBCXX \
|
||||||
THIRD_PARTY_LINENOISE \
|
THIRD_PARTY_LINENOISE \
|
||||||
THIRD_PARTY_LUA \
|
THIRD_PARTY_LUA \
|
||||||
THIRD_PARTY_MBEDTLS \
|
THIRD_PARTY_MBEDTLS \
|
||||||
THIRD_PARTY_MUSL \
|
THIRD_PARTY_MUSL \
|
||||||
THIRD_PARTY_NSYNC \
|
THIRD_PARTY_NSYNC \
|
||||||
THIRD_PARTY_NSYNC_MEM \
|
THIRD_PARTY_NSYNC_MEM \
|
||||||
THIRD_PARTY_OPENMP \
|
THIRD_PARTY_OPENMP \
|
||||||
THIRD_PARTY_SED \
|
THIRD_PARTY_SED \
|
||||||
THIRD_PARTY_STB \
|
THIRD_PARTY_STB \
|
||||||
THIRD_PARTY_TR \
|
THIRD_PARTY_TR \
|
||||||
THIRD_PARTY_VQSORT \
|
THIRD_PARTY_VQSORT \
|
||||||
THIRD_PARTY_XED \
|
THIRD_PARTY_XED \
|
||||||
THIRD_PARTY_ZLIB \
|
THIRD_PARTY_ZLIB \
|
||||||
TOOL_ARGS \
|
TOOL_ARGS \
|
||||||
TOOL_BUILD_LIB \
|
TOOL_BUILD_LIB \
|
||||||
TOOL_VIZ_LIB
|
TOOL_VIZ_LIB
|
||||||
|
|
||||||
EXAMPLES_DEPS := \
|
EXAMPLES_DEPS := \
|
||||||
$(call uniq,$(foreach x,$(EXAMPLES_DIRECTDEPS),$($(x))))
|
$(call uniq,$(foreach x,$(EXAMPLES_DIRECTDEPS),$($(x))))
|
||||||
|
|
||||||
o/$(MODE)/examples/examples.pkg: \
|
o/$(MODE)/examples/examples.pkg: \
|
||||||
$(EXAMPLES_OBJS) \
|
$(EXAMPLES_OBJS) \
|
||||||
$(foreach x,$(EXAMPLES_DIRECTDEPS),$($(x)_A).pkg)
|
$(foreach x,$(EXAMPLES_DIRECTDEPS),$($(x)_A).pkg)
|
||||||
|
|
||||||
o/$(MODE)/examples/unbourne.o: private \
|
o/$(MODE)/examples/unbourne.o: private \
|
||||||
CPPFLAGS += \
|
CPPFLAGS += \
|
||||||
-DSTACK_FRAME_UNLIMITED \
|
-DSTACK_FRAME_UNLIMITED \
|
||||||
-fpie
|
-fpie
|
||||||
|
|
||||||
o/$(MODE)/examples/%.com.dbg: \
|
o/$(MODE)/examples/%.dbg: \
|
||||||
$(EXAMPLES_DEPS) \
|
$(EXAMPLES_DEPS) \
|
||||||
o/$(MODE)/examples/%.o \
|
o/$(MODE)/examples/%.o \
|
||||||
o/$(MODE)/examples/examples.pkg \
|
o/$(MODE)/examples/examples.pkg \
|
||||||
$(EXAMPLES_BOOTLOADER)
|
$(EXAMPLES_BOOTLOADER)
|
||||||
@$(APELINK)
|
@$(APELINK)
|
||||||
|
|
||||||
o/$(MODE)/examples/hellolua.com.dbg: \
|
o/$(MODE)/examples/hellolua.dbg: \
|
||||||
$(EXAMPLES_DEPS) \
|
$(EXAMPLES_DEPS) \
|
||||||
o/$(MODE)/examples/hellolua.o \
|
o/$(MODE)/examples/hellolua.o \
|
||||||
o/$(MODE)/examples/hellolua.lua.zip.o \
|
o/$(MODE)/examples/hellolua.lua.zip.o \
|
||||||
o/$(MODE)/examples/examples.pkg \
|
o/$(MODE)/examples/examples.pkg \
|
||||||
$(EXAMPLES_BOOTLOADER)
|
$(EXAMPLES_BOOTLOADER)
|
||||||
@$(APELINK)
|
@$(APELINK)
|
||||||
|
|
||||||
o/$(MODE)/examples/ispell.com.dbg: \
|
o/$(MODE)/examples/ispell.dbg: \
|
||||||
$(EXAMPLES_DEPS) \
|
$(EXAMPLES_DEPS) \
|
||||||
o/$(MODE)/examples/ispell.o \
|
o/$(MODE)/examples/ispell.o \
|
||||||
o/$(MODE)/usr/share/dict/words.zip.o \
|
o/$(MODE)/usr/share/dict/words.zip.o \
|
||||||
o/$(MODE)/examples/examples.pkg \
|
o/$(MODE)/examples/examples.pkg \
|
||||||
$(EXAMPLES_BOOTLOADER)
|
$(EXAMPLES_BOOTLOADER)
|
||||||
@$(APELINK)
|
@$(APELINK)
|
||||||
|
|
||||||
o/$(MODE)/examples/nesemu1.com.dbg: \
|
o/$(MODE)/examples/nesemu1.dbg: \
|
||||||
$(EXAMPLES_DEPS) \
|
$(EXAMPLES_DEPS) \
|
||||||
o/$(MODE)/examples/nesemu1.o \
|
o/$(MODE)/examples/nesemu1.o \
|
||||||
o/$(MODE)/usr/share/rom/mario.nes.zip.o \
|
o/$(MODE)/usr/share/rom/mario.nes.zip.o \
|
||||||
o/$(MODE)/usr/share/rom/zelda.nes.zip.o \
|
o/$(MODE)/usr/share/rom/zelda.nes.zip.o \
|
||||||
o/$(MODE)/usr/share/rom/tetris.nes.zip.o \
|
o/$(MODE)/usr/share/rom/tetris.nes.zip.o \
|
||||||
o/$(MODE)/examples/examples.pkg \
|
o/$(MODE)/examples/examples.pkg \
|
||||||
$(EXAMPLES_BOOTLOADER)
|
$(EXAMPLES_BOOTLOADER)
|
||||||
@$(APELINK)
|
@$(APELINK)
|
||||||
|
|
||||||
|
@ -145,7 +145,7 @@ o/$(MODE)/examples/picol.o: private \
|
||||||
CPPFLAGS += \
|
CPPFLAGS += \
|
||||||
-DSTACK_FRAME_UNLIMITED
|
-DSTACK_FRAME_UNLIMITED
|
||||||
|
|
||||||
o/$(MODE)/examples/picol.com.dbg: \
|
o/$(MODE)/examples/picol.dbg: \
|
||||||
$(EXAMPLES_DEPS) \
|
$(EXAMPLES_DEPS) \
|
||||||
o/$(MODE)/examples/picol.o \
|
o/$(MODE)/examples/picol.o \
|
||||||
o/$(MODE)/examples/examples.pkg \
|
o/$(MODE)/examples/examples.pkg \
|
||||||
|
@ -166,8 +166,8 @@ o/$(MODE)/usr/share/dict/words: \
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
.PHONY: o/$(MODE)/examples
|
.PHONY: o/$(MODE)/examples
|
||||||
o/$(MODE)/examples: \
|
o/$(MODE)/examples: \
|
||||||
o/$(MODE)/examples/package \
|
o/$(MODE)/examples/package \
|
||||||
o/$(MODE)/examples/pylife \
|
o/$(MODE)/examples/pylife \
|
||||||
o/$(MODE)/examples/pyapp \
|
o/$(MODE)/examples/pyapp \
|
||||||
$(EXAMPLES_BINS)
|
$(EXAMPLES_BINS)
|
||||||
|
|
|
@ -14,13 +14,13 @@
|
||||||
# GETTING STARTED
|
# GETTING STARTED
|
||||||
#
|
#
|
||||||
# # run these commands after cloning the cosmo repo on linux
|
# # run these commands after cloning the cosmo repo on linux
|
||||||
# $ make -j8 o//examples/pyapp/pyapp.com
|
# $ make -j8 o//examples/pyapp/pyapp
|
||||||
# $ o//examples/pyapp/pyapp.com
|
# $ o//examples/pyapp/pyapp
|
||||||
# cosmopolitan is cool!
|
# cosmopolitan is cool!
|
||||||
#
|
#
|
||||||
# HOW IT WORKS
|
# HOW IT WORKS
|
||||||
#
|
#
|
||||||
# $ pyobj.com -m -o pyapp.o pyapp.py
|
# $ pyobj -m -o pyapp.o pyapp.py
|
||||||
# $ ld -static -nostdlib -T o//ape/ape.lds ape.o crt.o \
|
# $ ld -static -nostdlib -T o//ape/ape.lds ape.o crt.o \
|
||||||
# pyapp.o \
|
# pyapp.o \
|
||||||
# cosmopolitan-python-stage2.a \
|
# cosmopolitan-python-stage2.a \
|
||||||
|
@ -29,19 +29,19 @@
|
||||||
# cosmopolitan-bzip2.a \
|
# cosmopolitan-bzip2.a \
|
||||||
# cosmopolitan-python-stage1.a \
|
# cosmopolitan-python-stage1.a \
|
||||||
# cosmopolitan.a
|
# cosmopolitan.a
|
||||||
# $ ./pyapp.com
|
# $ ./pyapp
|
||||||
# cosmopolitan is cool!
|
# cosmopolitan is cool!
|
||||||
#
|
#
|
||||||
# NOTES
|
# NOTES
|
||||||
#
|
#
|
||||||
# If you enjoy this tutorial, let us know jtunney@gmail.com. If
|
# If you enjoy this tutorial, let us know jtunney@gmail. If
|
||||||
# you're building something cool, then we can we can add you to
|
# you're building something cool, then we can we can add you to
|
||||||
# our .gitowners file which grants you commit access so you can
|
# our .gitowners file which grants you commit access so you can
|
||||||
# indepnedently maintain your package, as part of the mono-repo
|
# indepnedently maintain your package, as part of the mono-repo
|
||||||
|
|
||||||
PKGS += PYAPP
|
PKGS += PYAPP
|
||||||
PYAPP = $(PYAPP_DEPS) o/$(MODE)/examples/pyapp/pyapp.a
|
PYAPP = $(PYAPP_DEPS) o/$(MODE)/examples/pyapp/pyapp.a
|
||||||
PYAPP_COMS = o/$(MODE)/examples/pyapp/pyapp.com
|
PYAPP_COMS = o/$(MODE)/examples/pyapp/pyapp
|
||||||
PYAPP_BINS = $(PYAPP_COMS) $(PYAPP_COMS:%=%.dbg)
|
PYAPP_BINS = $(PYAPP_COMS) $(PYAPP_COMS:%=%.dbg)
|
||||||
|
|
||||||
# Specify our Cosmopolitan library dependencies
|
# Specify our Cosmopolitan library dependencies
|
||||||
|
@ -58,7 +58,7 @@ PYAPP_DIRECTDEPS = \
|
||||||
# them all out and arranges them in the correct order.
|
# them all out and arranges them in the correct order.
|
||||||
PYAPP_DEPS := $(call uniq,$(foreach x,$(PYAPP_DIRECTDEPS),$($(x))))
|
PYAPP_DEPS := $(call uniq,$(foreach x,$(PYAPP_DIRECTDEPS),$($(x))))
|
||||||
|
|
||||||
# # Asks PYOBJ.COM to turn our Python source into an ELF object which
|
# # Asks PYOBJ to turn our Python source into an ELF object which
|
||||||
# # contains (a) embedded zip file artifacts of our .py file and .pyc
|
# # contains (a) embedded zip file artifacts of our .py file and .pyc
|
||||||
# # which it it compiled; and (b) statically analyzed listings of our
|
# # which it it compiled; and (b) statically analyzed listings of our
|
||||||
# # python namespaces and imports that GNU ld will use for tree shake
|
# # python namespaces and imports that GNU ld will use for tree shake
|
||||||
|
@ -71,18 +71,18 @@ PYAPP_DEPS := $(call uniq,$(foreach x,$(PYAPP_DIRECTDEPS),$($(x))))
|
||||||
# in `.python/` (which is accessible via open() system calls, using
|
# in `.python/` (which is accessible via open() system calls, using
|
||||||
# the synthetic path `"/zip/.python/"`) which means that if we want
|
# the synthetic path `"/zip/.python/"`) which means that if we want
|
||||||
# to turn `pyapp/pyapp.py` into `.python/pyapp.py` so it's imported
|
# to turn `pyapp/pyapp.py` into `.python/pyapp.py` so it's imported
|
||||||
# using `import pyapp` then we can simply append to PYOBJ.COM flags
|
# using `import pyapp` then we can simply append to PYOBJ flags
|
||||||
# flags above asking it to strip one directory component and prefix
|
# flags above asking it to strip one directory component and prefix
|
||||||
# Lastly be sure that whenever you use this variable override trick
|
# Lastly be sure that whenever you use this variable override trick
|
||||||
# you only do it to .o files, since otherwise it'll ruin everything
|
# you only do it to .o files, since otherwise it'll ruin everything
|
||||||
# Passing -m to PYOBJ.COM causes a C main() function to get yoinked
|
# Passing -m to PYOBJ causes a C main() function to get yoinked
|
||||||
# and it means our Python module can no longer be used as a library
|
# and it means our Python module can no longer be used as a library
|
||||||
o/$(MODE)/examples/pyapp/pyapp.o: PYFLAGS += -m -C2 -P.python
|
o/$(MODE)/examples/pyapp/pyapp.o: PYFLAGS += -m -C2 -P.python
|
||||||
|
|
||||||
# Asks PACKAGE.COM to sanity check our DIRECTDEPS and symbol graph.
|
# Asks PACKAGE to sanity check our DIRECTDEPS and symbol graph.
|
||||||
# This program functions as an incremental linker. It also provides
|
# This program functions as an incremental linker. It also provides
|
||||||
# enhancements to the object code that GCC generated similar to LTO
|
# enhancements to the object code that GCC generated similar to LTO
|
||||||
# so be certain that your .com.dbg rule depends on the .pkg output!
|
# so be certain that your .dbg rule depends on the .pkg output!
|
||||||
o/$(MODE)/examples/pyapp/pyapp.pkg: \
|
o/$(MODE)/examples/pyapp/pyapp.pkg: \
|
||||||
o/$(MODE)/examples/pyapp/pyapp.o \
|
o/$(MODE)/examples/pyapp/pyapp.o \
|
||||||
$(foreach x,$(PYAPP_DIRECTDEPS),$($(x)_A).pkg)
|
$(foreach x,$(PYAPP_DIRECTDEPS),$($(x)_A).pkg)
|
||||||
|
@ -90,7 +90,7 @@ o/$(MODE)/examples/pyapp/pyapp.pkg: \
|
||||||
# Ask GNU LD to link our APE executable within an ELF binary shell.
|
# Ask GNU LD to link our APE executable within an ELF binary shell.
|
||||||
# The CRT and APE dependencies are special dependencies that define
|
# The CRT and APE dependencies are special dependencies that define
|
||||||
# your _start() / WinMain() entrpoints as well as APE linker script
|
# your _start() / WinMain() entrpoints as well as APE linker script
|
||||||
o/$(MODE)/examples/pyapp/pyapp.com.dbg: \
|
o/$(MODE)/examples/pyapp/pyapp.dbg: \
|
||||||
$(PYAPP_DEPS) \
|
$(PYAPP_DEPS) \
|
||||||
o/$(MODE)/examples/pyapp/pyapp.pkg \
|
o/$(MODE)/examples/pyapp/pyapp.pkg \
|
||||||
o/$(MODE)/examples/pyapp/pyapp.o \
|
o/$(MODE)/examples/pyapp/pyapp.o \
|
||||||
|
@ -98,10 +98,10 @@ o/$(MODE)/examples/pyapp/pyapp.com.dbg: \
|
||||||
$(APE_NO_MODIFY_SELF)
|
$(APE_NO_MODIFY_SELF)
|
||||||
@$(COMPILE) -ALINK.ape $(LINK) $(LINKARGS) -o $@
|
@$(COMPILE) -ALINK.ape $(LINK) $(LINKARGS) -o $@
|
||||||
|
|
||||||
# # Unwrap the APE .COM binary, that's embedded within the linked file
|
# # Unwrap the APE binary, that's embedded within the linked file
|
||||||
# # NOTE: This line can be commented out, since it's in build/rules.mk
|
# # NOTE: This line can be commented out, since it's in build/rules.mk
|
||||||
# o/$(MODE)/examples/pyapp/pyapp.com: \
|
# o/$(MODE)/examples/pyapp/pyapp: \
|
||||||
# o/$(MODE)/examples/pyapp/pyapp.com.dbg
|
# o/$(MODE)/examples/pyapp/pyapp.dbg
|
||||||
# $(OBJCOPY) -S -O binary $< $@
|
# $(OBJCOPY) -S -O binary $< $@
|
||||||
|
|
||||||
# Ensure that build config changes will invalidate build artifacts.
|
# Ensure that build config changes will invalidate build artifacts.
|
||||||
|
@ -112,5 +112,5 @@ o/$(MODE)/examples/pyapp/pyapp.o: \
|
||||||
# and have it build all targets the package defines.
|
# and have it build all targets the package defines.
|
||||||
.PHONY: o/$(MODE)/examples/pyapp
|
.PHONY: o/$(MODE)/examples/pyapp
|
||||||
o/$(MODE)/examples/pyapp: \
|
o/$(MODE)/examples/pyapp: \
|
||||||
o/$(MODE)/examples/pyapp/pyapp.com \
|
o/$(MODE)/examples/pyapp/pyapp \
|
||||||
o/$(MODE)/examples/pyapp/pyapp.com.dbg
|
o/$(MODE)/examples/pyapp/pyapp.dbg
|
||||||
|
|
|
@ -14,13 +14,13 @@
|
||||||
# GETTING STARTED
|
# GETTING STARTED
|
||||||
#
|
#
|
||||||
# # run these commands after cloning the cosmo repo on linux
|
# # run these commands after cloning the cosmo repo on linux
|
||||||
# $ make -j8 o//examples/pylife/pylife.com
|
# $ make -j8 o//examples/pylife/pylife
|
||||||
# $ o//examples/pylife/pylife.com
|
# $ o//examples/pylife/pylife
|
||||||
# cosmopolitan is cool!
|
# cosmopolitan is cool!
|
||||||
#
|
#
|
||||||
# HOW IT WORKS
|
# HOW IT WORKS
|
||||||
#
|
#
|
||||||
# $ pyobj.com -m -o pylife.o pylife.py
|
# $ pyobj -m -o pylife.o pylife.py
|
||||||
# $ ld -static -nostdlib -T o//ape/ape.lds ape.o crt.o \
|
# $ ld -static -nostdlib -T o//ape/ape.lds ape.o crt.o \
|
||||||
# pylife.o \
|
# pylife.o \
|
||||||
# cosmopolitan-python-stage2.a \
|
# cosmopolitan-python-stage2.a \
|
||||||
|
@ -29,19 +29,19 @@
|
||||||
# cosmopolitan-bzip2.a \
|
# cosmopolitan-bzip2.a \
|
||||||
# cosmopolitan-python-stage1.a \
|
# cosmopolitan-python-stage1.a \
|
||||||
# cosmopolitan.a
|
# cosmopolitan.a
|
||||||
# $ ./pylife.com
|
# $ ./pylife
|
||||||
# cosmopolitan is cool!
|
# cosmopolitan is cool!
|
||||||
#
|
#
|
||||||
# NOTES
|
# NOTES
|
||||||
#
|
#
|
||||||
# If you enjoy this tutorial, let us know jtunney@gmail.com. If
|
# If you enjoy this tutorial, let us know jtunney@gmail. If
|
||||||
# you're building something cool, then we can we can add you to
|
# you're building something cool, then we can we can add you to
|
||||||
# our .gitowners file which grants you commit access so you can
|
# our .gitowners file which grants you commit access so you can
|
||||||
# indepnedently maintain your package, as part of the mono-repo
|
# indepnedently maintain your package, as part of the mono-repo
|
||||||
|
|
||||||
PKGS += PYLIFE
|
PKGS += PYLIFE
|
||||||
PYLIFE = $(PYLIFE_DEPS) o/$(MODE)/examples/pylife/pylife.a
|
PYLIFE = $(PYLIFE_DEPS) o/$(MODE)/examples/pylife/pylife.a
|
||||||
PYLIFE_COMS = o/$(MODE)/examples/pylife/pylife.com
|
PYLIFE_COMS = o/$(MODE)/examples/pylife/pylife
|
||||||
PYLIFE_BINS = $(PYLIFE_COMS) $(PYLIFE_COMS:%=%.dbg)
|
PYLIFE_BINS = $(PYLIFE_COMS) $(PYLIFE_COMS:%=%.dbg)
|
||||||
|
|
||||||
# Specify our Cosmopolitan library dependencies
|
# Specify our Cosmopolitan library dependencies
|
||||||
|
@ -58,7 +58,7 @@ PYLIFE_DIRECTDEPS = \
|
||||||
# them all out and arranges them in the correct order.
|
# them all out and arranges them in the correct order.
|
||||||
PYLIFE_DEPS := $(call uniq,$(foreach x,$(PYLIFE_DIRECTDEPS),$($(x))))
|
PYLIFE_DEPS := $(call uniq,$(foreach x,$(PYLIFE_DIRECTDEPS),$($(x))))
|
||||||
|
|
||||||
# # Asks PYOBJ.COM to turn our Python source into an ELF object which
|
# # Asks PYOBJ to turn our Python source into an ELF object which
|
||||||
# # contains (a) embedded zip file artifacts of our .py file and .pyc
|
# # contains (a) embedded zip file artifacts of our .py file and .pyc
|
||||||
# # which it it compiled; and (b) statically analyzed listings of our
|
# # which it it compiled; and (b) statically analyzed listings of our
|
||||||
# # python namespaces and imports that GNU ld will use for tree shake
|
# # python namespaces and imports that GNU ld will use for tree shake
|
||||||
|
@ -71,18 +71,18 @@ PYLIFE_DEPS := $(call uniq,$(foreach x,$(PYLIFE_DIRECTDEPS),$($(x))))
|
||||||
# in `.python/` (which is accessible via open() system calls, using
|
# in `.python/` (which is accessible via open() system calls, using
|
||||||
# the synthetic path `"/zip/.python/"`) which means that if we want
|
# the synthetic path `"/zip/.python/"`) which means that if we want
|
||||||
# to turn `pylife/pylife.py` into `.python/pylife.py` so it's imported
|
# to turn `pylife/pylife.py` into `.python/pylife.py` so it's imported
|
||||||
# using `import pylife` then we can simply append to PYOBJ.COM flags
|
# using `import pylife` then we can simply append to PYOBJ flags
|
||||||
# flags above asking it to strip one directory component and prefix
|
# flags above asking it to strip one directory component and prefix
|
||||||
# Lastly be sure that whenever you use this variable override trick
|
# Lastly be sure that whenever you use this variable override trick
|
||||||
# you only do it to .o files, since otherwise it'll ruin everything
|
# you only do it to .o files, since otherwise it'll ruin everything
|
||||||
# Passing -m to PYOBJ.COM causes a C main() function to get yoinked
|
# Passing -m to PYOBJ causes a C main() function to get yoinked
|
||||||
# and it means our Python module can no longer be used as a library
|
# and it means our Python module can no longer be used as a library
|
||||||
o/$(MODE)/examples/pylife/pylife.o: PYFLAGS += -m -C2 -P.python
|
o/$(MODE)/examples/pylife/pylife.o: PYFLAGS += -m -C2 -P.python
|
||||||
|
|
||||||
# Asks PACKAGE.COM to sanity check our DIRECTDEPS and symbol graph.
|
# Asks PACKAGE to sanity check our DIRECTDEPS and symbol graph.
|
||||||
# This program functions as an incremental linker. It also provides
|
# This program functions as an incremental linker. It also provides
|
||||||
# enhancements to the object code that GCC generated similar to LTO
|
# enhancements to the object code that GCC generated similar to LTO
|
||||||
# so be certain that your .com.dbg rule depends on the .pkg output!
|
# so be certain that your .dbg rule depends on the .pkg output!
|
||||||
o/$(MODE)/examples/pylife/pylife.pkg: \
|
o/$(MODE)/examples/pylife/pylife.pkg: \
|
||||||
o/$(MODE)/examples/pylife/pylife.o \
|
o/$(MODE)/examples/pylife/pylife.o \
|
||||||
$(foreach x,$(PYLIFE_DIRECTDEPS),$($(x)_A).pkg)
|
$(foreach x,$(PYLIFE_DIRECTDEPS),$($(x)_A).pkg)
|
||||||
|
@ -90,7 +90,7 @@ o/$(MODE)/examples/pylife/pylife.pkg: \
|
||||||
# Ask GNU LD to link our APE executable within an ELF binary shell.
|
# Ask GNU LD to link our APE executable within an ELF binary shell.
|
||||||
# The CRT and APE dependencies are special dependencies that define
|
# The CRT and APE dependencies are special dependencies that define
|
||||||
# your _start() / WinMain() entrpoints as well as APE linker script
|
# your _start() / WinMain() entrpoints as well as APE linker script
|
||||||
o/$(MODE)/examples/pylife/pylife.com.dbg: \
|
o/$(MODE)/examples/pylife/pylife.dbg: \
|
||||||
$(PYLIFE_DEPS) \
|
$(PYLIFE_DEPS) \
|
||||||
o/$(MODE)/examples/pylife/pylife.pkg \
|
o/$(MODE)/examples/pylife/pylife.pkg \
|
||||||
o/$(MODE)/examples/pylife/pylife.o \
|
o/$(MODE)/examples/pylife/pylife.o \
|
||||||
|
@ -98,10 +98,10 @@ o/$(MODE)/examples/pylife/pylife.com.dbg: \
|
||||||
$(APE_NO_MODIFY_SELF)
|
$(APE_NO_MODIFY_SELF)
|
||||||
@$(COMPILE) -ALINK.ape $(LINK) $(LINKARGS) -o $@
|
@$(COMPILE) -ALINK.ape $(LINK) $(LINKARGS) -o $@
|
||||||
|
|
||||||
# # Unwrap the APE .COM binary, that's embedded within the linked file
|
# # Unwrap the APE binary, that's embedded within the linked file
|
||||||
# # NOTE: This line can be commented out, since it's in build/rules.mk
|
# # NOTE: This line can be commented out, since it's in build/rules.mk
|
||||||
# o/$(MODE)/examples/pylife/pylife.com: \
|
# o/$(MODE)/examples/pylife/pylife: \
|
||||||
# o/$(MODE)/examples/pylife/pylife.com.dbg
|
# o/$(MODE)/examples/pylife/pylife.dbg
|
||||||
# $(OBJCOPY) -S -O binary $< $@
|
# $(OBJCOPY) -S -O binary $< $@
|
||||||
|
|
||||||
# Ensure that build config changes will invalidate build artifacts.
|
# Ensure that build config changes will invalidate build artifacts.
|
||||||
|
@ -112,5 +112,5 @@ o/$(MODE)/examples/pylife/pylife.o: \
|
||||||
# and have it build all targets the package defines.
|
# and have it build all targets the package defines.
|
||||||
.PHONY: o/$(MODE)/examples/pylife
|
.PHONY: o/$(MODE)/examples/pylife
|
||||||
o/$(MODE)/examples/pylife: \
|
o/$(MODE)/examples/pylife: \
|
||||||
o/$(MODE)/examples/pylife/pylife.com \
|
o/$(MODE)/examples/pylife/pylife \
|
||||||
o/$(MODE)/examples/pylife/pylife.com.dbg
|
o/$(MODE)/examples/pylife/pylife.dbg
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
* Changes permissions on file, e.g.:
|
* Changes permissions on file, e.g.:
|
||||||
*
|
*
|
||||||
* CHECK_NE(-1, chmod("foo/bar.txt", 0644));
|
* CHECK_NE(-1, chmod("foo/bar.txt", 0644));
|
||||||
* CHECK_NE(-1, chmod("o/default/program.com", 0755));
|
* CHECK_NE(-1, chmod("o/default/program", 0755));
|
||||||
* CHECK_NE(-1, chmod("privatefolder/", 0700));
|
* CHECK_NE(-1, chmod("privatefolder/", 0700));
|
||||||
*
|
*
|
||||||
* The esoteric bits generally available on System Five are:
|
* The esoteric bits generally available on System Five are:
|
||||||
|
|
|
@ -36,7 +36,7 @@ int sys_fchmodat2(int, const char *, unsigned, int);
|
||||||
* Changes permissions on file, e.g.:
|
* Changes permissions on file, e.g.:
|
||||||
*
|
*
|
||||||
* CHECK_NE(-1, fchmodat(AT_FDCWD, "foo/bar.txt", 0644));
|
* CHECK_NE(-1, fchmodat(AT_FDCWD, "foo/bar.txt", 0644));
|
||||||
* CHECK_NE(-1, fchmodat(AT_FDCWD, "o/default/program.com", 0755));
|
* CHECK_NE(-1, fchmodat(AT_FDCWD, "o/default/program", 0755));
|
||||||
* CHECK_NE(-1, fchmodat(AT_FDCWD, "privatefolder/", 0700));
|
* CHECK_NE(-1, fchmodat(AT_FDCWD, "privatefolder/", 0700));
|
||||||
*
|
*
|
||||||
* @param path must exist
|
* @param path must exist
|
||||||
|
|
|
@ -118,6 +118,8 @@ static char *CopyWithCwd(const char *q, char *p, char *e) {
|
||||||
|
|
||||||
// if q exists then turn it into an absolute path. we also try adding
|
// if q exists then turn it into an absolute path. we also try adding
|
||||||
// a .com suffix since the ape auto-appends it when resolving
|
// a .com suffix since the ape auto-appends it when resolving
|
||||||
|
//
|
||||||
|
// TODO(jart): is this still relevant?
|
||||||
static int TryPath(const char *q, int com) {
|
static int TryPath(const char *q, int com) {
|
||||||
char *p;
|
char *p;
|
||||||
if (!(p = CopyWithCwd(q, g_prog.u.buf,
|
if (!(p = CopyWithCwd(q, g_prog.u.buf,
|
||||||
|
|
|
@ -950,14 +950,14 @@ static const uint16_t kPledgeUnveil[] = {
|
||||||
|
|
||||||
// placeholder group
|
// placeholder group
|
||||||
//
|
//
|
||||||
// pledge.com checks this to do auto-unveiling
|
// pledge checks this to do auto-unveiling
|
||||||
static const uint16_t kPledgeVminfo[] = {
|
static const uint16_t kPledgeVminfo[] = {
|
||||||
__NR_linux_sched_yield, //
|
__NR_linux_sched_yield, //
|
||||||
};
|
};
|
||||||
|
|
||||||
// placeholder group
|
// placeholder group
|
||||||
//
|
//
|
||||||
// pledge.com uses this to auto-unveil /tmp and $TMPPATH with rwc
|
// pledge uses this to auto-unveil /tmp and $TMPPATH with rwc
|
||||||
// permissions. pledge() alone (without unveil() too) offers very
|
// permissions. pledge() alone (without unveil() too) offers very
|
||||||
// little security here. consider using them together.
|
// little security here. consider using them together.
|
||||||
static const uint16_t kPledgeTmppath[] = {
|
static const uint16_t kPledgeTmppath[] = {
|
||||||
|
|
|
@ -163,7 +163,7 @@
|
||||||
* interpreted, and ape binaries, you'll usually want `rpath` and
|
* interpreted, and ape binaries, you'll usually want `rpath` and
|
||||||
* `prot_exec` too. With APE it's possible to work around this
|
* `prot_exec` too. With APE it's possible to work around this
|
||||||
* requirement, by "assimilating" your binaries beforehand. See the
|
* requirement, by "assimilating" your binaries beforehand. See the
|
||||||
* assimilate.com program and `--assimilate` flag which can be used to
|
* assimilate program and `--assimilate` flag which can be used to
|
||||||
* turn APE binaries into static native binaries.
|
* turn APE binaries into static native binaries.
|
||||||
*
|
*
|
||||||
* - "prot_exec" allows mmap(PROT_EXEC) and mprotect(PROT_EXEC). This is
|
* - "prot_exec" allows mmap(PROT_EXEC) and mprotect(PROT_EXEC). This is
|
||||||
|
@ -176,13 +176,13 @@
|
||||||
* calls on Linux.
|
* calls on Linux.
|
||||||
*
|
*
|
||||||
* - "vminfo" OpenBSD defines this for programs like `top`. On Linux,
|
* - "vminfo" OpenBSD defines this for programs like `top`. On Linux,
|
||||||
* this is a placeholder group that lets tools like pledge.com check
|
* this is a placeholder group that lets tools like pledge check
|
||||||
* `__promises` and automatically unveil() a subset of files top would
|
* `__promises` and automatically unveil() a subset of files top would
|
||||||
* need, e.g. /proc/stat, /proc/meminfo.
|
* need, e.g. /proc/stat, /proc/meminfo.
|
||||||
*
|
*
|
||||||
* - "tmppath" allows unlink, unlinkat, and lstat. This is mostly a
|
* - "tmppath" allows unlink, unlinkat, and lstat. This is mostly a
|
||||||
* placeholder group for pledge.com, which reads the `__promises`
|
* placeholder group for pledge, which reads the `__promises` global
|
||||||
* global to determine if /tmp and $TMPPATH should be unveiled.
|
* to determine if /tmp and $TMPPATH should be unveiled.
|
||||||
*
|
*
|
||||||
* `execpromises` only matters if "exec" is specified in `promises`. In
|
* `execpromises` only matters if "exec" is specified in `promises`. In
|
||||||
* that case, this specifies the promises that'll apply once execve()
|
* that case, this specifies the promises that'll apply once execve()
|
||||||
|
|
|
@ -368,7 +368,7 @@ static textwindows int ProcessKeyEvent(const struct NtInputRecord *r, char *p) {
|
||||||
// To use the tty mouse events feature:
|
// To use the tty mouse events feature:
|
||||||
// - write(1, "\e[?1000;1002;1015;1006h") to enable
|
// - write(1, "\e[?1000;1002;1015;1006h") to enable
|
||||||
// - write(1, "\e[?1000;1002;1015;1006l") to disable
|
// - write(1, "\e[?1000;1002;1015;1006l") to disable
|
||||||
// See o//examples/ttyinfo.com and o//tool/viz/life.com
|
// See o//examples/ttyinfo and o//tool/viz/life
|
||||||
static textwindows int ProcessMouseEvent(const struct NtInputRecord *r,
|
static textwindows int ProcessMouseEvent(const struct NtInputRecord *r,
|
||||||
char *b) {
|
char *b) {
|
||||||
char *p = b;
|
char *p = b;
|
||||||
|
|
|
@ -116,7 +116,6 @@ _start:
|
||||||
9: .unreachable
|
9: .unreachable
|
||||||
|
|
||||||
// strongly link main() function (discarded by linker)
|
// strongly link main() function (discarded by linker)
|
||||||
// libc_runtime had to weakly link, due to package.com
|
|
||||||
.section .yoink
|
.section .yoink
|
||||||
call main
|
call main
|
||||||
.previous
|
.previous
|
||||||
|
@ -154,7 +153,6 @@ _start:
|
||||||
.unreachable
|
.unreachable
|
||||||
|
|
||||||
// strongly link main() function (discarded by linker)
|
// strongly link main() function (discarded by linker)
|
||||||
// libc_runtime had to weakly link, due to package.com
|
|
||||||
.section .yoink
|
.section .yoink
|
||||||
bl main
|
bl main
|
||||||
.previous
|
.previous
|
||||||
|
|
|
@ -24,7 +24,6 @@
|
||||||
#include "libc/errno.h"
|
#include "libc/errno.h"
|
||||||
#include "libc/intrin/asan.internal.h"
|
#include "libc/intrin/asan.internal.h"
|
||||||
#include "libc/intrin/atomic.h"
|
#include "libc/intrin/atomic.h"
|
||||||
#include "libc/serialize.h"
|
|
||||||
#include "libc/intrin/cmpxchg.h"
|
#include "libc/intrin/cmpxchg.h"
|
||||||
#include "libc/intrin/describebacktrace.internal.h"
|
#include "libc/intrin/describebacktrace.internal.h"
|
||||||
#include "libc/intrin/directmap.internal.h"
|
#include "libc/intrin/directmap.internal.h"
|
||||||
|
@ -45,6 +44,7 @@
|
||||||
#include "libc/runtime/runtime.h"
|
#include "libc/runtime/runtime.h"
|
||||||
#include "libc/runtime/stack.h"
|
#include "libc/runtime/stack.h"
|
||||||
#include "libc/runtime/symbols.internal.h"
|
#include "libc/runtime/symbols.internal.h"
|
||||||
|
#include "libc/serialize.h"
|
||||||
#include "libc/stdckdint.h"
|
#include "libc/stdckdint.h"
|
||||||
#include "libc/str/str.h"
|
#include "libc/str/str.h"
|
||||||
#include "libc/str/tab.internal.h"
|
#include "libc/str/tab.internal.h"
|
||||||
|
@ -767,7 +767,7 @@ static void __asan_report_memory_origin_image(intptr_t a, int z) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
kprintf("\tunknown please supply .com.dbg symbols or set COMDBG\n");
|
kprintf("\tunknown please supply .dbg symbols or set COMDBG\n");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
kprintf("\tunknown please __static_yoink(\"GetSymbolTable\");\n");
|
kprintf("\tunknown please __static_yoink(\"GetSymbolTable\");\n");
|
||||||
|
|
|
@ -97,7 +97,7 @@ __excep0_isr:
|
||||||
xor %eax,%eax # kprintf is variadic, remember to
|
xor %eax,%eax # kprintf is variadic, remember to
|
||||||
# pass no. of vector regs. used (= 0)
|
# pass no. of vector regs. used (= 0)
|
||||||
.weak kprintf # weakly link kprintf() because we
|
.weak kprintf # weakly link kprintf() because we
|
||||||
ezlea kprintf,bx # want to keep life.com tiny
|
ezlea kprintf,bx # want to keep examples/life tiny
|
||||||
test %ebx,%ebx
|
test %ebx,%ebx
|
||||||
jz 8f
|
jz 8f
|
||||||
call *%rbx # print error message
|
call *%rbx # print error message
|
||||||
|
|
|
@ -28,8 +28,8 @@
|
||||||
*
|
*
|
||||||
* This handler (1) makes binaries smaller by not embedding source code;
|
* This handler (1) makes binaries smaller by not embedding source code;
|
||||||
* and therefore (2) less likely to leak sensitive information. This can
|
* and therefore (2) less likely to leak sensitive information. This can
|
||||||
* still print backtraces with function names if the .com.dbg file is in
|
* still print backtraces with function names if the .dbg file is in the
|
||||||
* the same folder.
|
* same folder.
|
||||||
*
|
*
|
||||||
* @see libc/log/thunks/__check_fail_ndebug.S
|
* @see libc/log/thunks/__check_fail_ndebug.S
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -44,12 +44,12 @@
|
||||||
*
|
*
|
||||||
* delimited by spaces. For example, to see peak malloc usage:
|
* delimited by spaces. For example, to see peak malloc usage:
|
||||||
*
|
*
|
||||||
* ./myprog.com 2>log
|
* ./myprog 2>log
|
||||||
* grep ^MEM log | sort -nk4 | tail -n10
|
* grep ^MEM log | sort -nk4 | tail -n10
|
||||||
*
|
*
|
||||||
* To see the largest allocations:
|
* To see the largest allocations:
|
||||||
*
|
*
|
||||||
* ./myprog.com 2>log
|
* ./myprog 2>log
|
||||||
* grep ^MEM log | grep -v free | sort -nk7 | tail -n10
|
* grep ^MEM log | grep -v free | sort -nk7 | tail -n10
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
@ -25,12 +25,12 @@
|
||||||
#include "libc/fmt/conv.h"
|
#include "libc/fmt/conv.h"
|
||||||
#include "libc/fmt/itoa.h"
|
#include "libc/fmt/itoa.h"
|
||||||
#include "libc/fmt/magnumstrs.internal.h"
|
#include "libc/fmt/magnumstrs.internal.h"
|
||||||
#include "libc/serialize.h"
|
|
||||||
#include "libc/intrin/getenv.internal.h"
|
#include "libc/intrin/getenv.internal.h"
|
||||||
#include "libc/intrin/weaken.h"
|
#include "libc/intrin/weaken.h"
|
||||||
#include "libc/limits.h"
|
#include "libc/limits.h"
|
||||||
#include "libc/macros.internal.h"
|
#include "libc/macros.internal.h"
|
||||||
#include "libc/runtime/runtime.h"
|
#include "libc/runtime/runtime.h"
|
||||||
|
#include "libc/serialize.h"
|
||||||
#include "libc/stdio/stdio.h"
|
#include "libc/stdio/stdio.h"
|
||||||
#include "libc/str/str.h"
|
#include "libc/str/str.h"
|
||||||
#include "libc/sysv/consts/lock.h"
|
#include "libc/sysv/consts/lock.h"
|
||||||
|
@ -986,7 +986,7 @@ int _cocmd(int argc, char **argv, char **envp) {
|
||||||
size_t globCount = 0;
|
size_t globCount = 0;
|
||||||
int globFlags = 0;
|
int globFlags = 0;
|
||||||
glob_t globTheBuilder;
|
glob_t globTheBuilder;
|
||||||
prog = argc > 0 ? argv[0] : "cocmd.com";
|
prog = argc > 0 ? argv[0] : "cocmd";
|
||||||
|
|
||||||
for (i = 1; i < 32; ++i) {
|
for (i = 1; i < 32; ++i) {
|
||||||
unsupported[i] = true;
|
unsupported[i] = true;
|
||||||
|
|
|
@ -53,23 +53,19 @@ static struct {
|
||||||
} g_execve;
|
} g_execve;
|
||||||
|
|
||||||
static bool IsApeFile(const char *path) {
|
static bool IsApeFile(const char *path) {
|
||||||
if (endswith(path, ".com")) {
|
bool res = false;
|
||||||
return true;
|
BLOCK_SIGNALS;
|
||||||
} else {
|
BLOCK_CANCELATION;
|
||||||
bool res = false;
|
int fd;
|
||||||
BLOCK_SIGNALS;
|
char buf[8];
|
||||||
BLOCK_CANCELATION;
|
int flags = O_RDONLY | O_NOCTTY | O_NONBLOCK | O_CLOEXEC;
|
||||||
int fd;
|
if ((fd = sys_openat(AT_FDCWD, path, flags, 0)) != -1) {
|
||||||
char buf[8];
|
res = sys_pread(fd, buf, 8, 0, 0) == 8 && IsApeLoadable(buf);
|
||||||
int flags = O_RDONLY | O_NOCTTY | O_NONBLOCK | O_CLOEXEC;
|
sys_close(fd);
|
||||||
if ((fd = sys_openat(AT_FDCWD, path, flags, 0)) != -1) {
|
|
||||||
res = sys_pread(fd, buf, 8, 0, 0) == 8 && IsApeLoadable(buf);
|
|
||||||
sys_close(fd);
|
|
||||||
}
|
|
||||||
ALLOW_CANCELATION;
|
|
||||||
ALLOW_SIGNALS;
|
|
||||||
return res;
|
|
||||||
}
|
}
|
||||||
|
ALLOW_CANCELATION;
|
||||||
|
ALLOW_SIGNALS;
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *Join(const char *a, const char *b, char buf[PATH_MAX]) {
|
static const char *Join(const char *a, const char *b, char buf[PATH_MAX]) {
|
||||||
|
|
|
@ -160,7 +160,7 @@ static void EfiInitAcpi(struct mman *mm, EFI_SYSTEM_TABLE *SystemTable) {
|
||||||
* -net none \
|
* -net none \
|
||||||
* -drive format=raw,file=fat:rw:o/tool/viz
|
* -drive format=raw,file=fat:rw:o/tool/viz
|
||||||
* FS0:
|
* FS0:
|
||||||
* deathstar.com
|
* deathstar
|
||||||
*
|
*
|
||||||
* @see libc/dce.h
|
* @see libc/dce.h
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -88,7 +88,7 @@ static struct SymbolTable *GetSymbolTableFromZip(struct Zipos *zipos) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reads symbol table from .com.dbg file.
|
* Reads symbol table from .dbg file.
|
||||||
* @note This code can't depend on dlmalloc()
|
* @note This code can't depend on dlmalloc()
|
||||||
*/
|
*/
|
||||||
static struct SymbolTable *GetSymbolTableFromElf(void) {
|
static struct SymbolTable *GetSymbolTableFromElf(void) {
|
||||||
|
@ -109,11 +109,11 @@ static struct SymbolTable *GetSymbolTableFromElf(void) {
|
||||||
* __static_yoink("__zipos_get");
|
* __static_yoink("__zipos_get");
|
||||||
*
|
*
|
||||||
* In that case, the symbol table may be read from `/zip/.symtab` which
|
* In that case, the symbol table may be read from `/zip/.symtab` which
|
||||||
* is generated by `o//tool/build/symtab.com`. The second strategy is to
|
* is generated by `o//tool/build/symtab`. The second strategy is to
|
||||||
* look for the concomitant `.com.dbg` executable, which may very well
|
* look for the concomitant `.dbg` executable, which may very well be
|
||||||
* be the one currently executing, or it could be placed in the same
|
* the one currently executing, or it could be placed in the same folder
|
||||||
* folder as your `.com` binary, or lastly, it could be explicitly
|
* as your binary, or lastly, it could be explicitly specified via the
|
||||||
* specified via the `COMDBG` environment variable.
|
* `COMDBG` environment variable.
|
||||||
*
|
*
|
||||||
* Function tracing is disabled throughout the duration of this call.
|
* Function tracing is disabled throughout the duration of this call.
|
||||||
* Backtraces and other core runtime functionality depend on this.
|
* Backtraces and other core runtime functionality depend on this.
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
[ -d libc/str ] || exit
|
[ -d libc/str ] || exit
|
||||||
[ -x o//examples/curl.com ] || make -j8 o//examples/curl.com || exit
|
[ -x o//tool/curl/curl ] || make -j8 o//tool/curl/curl || exit
|
||||||
mkdir -p o/tmp/ || exit
|
mkdir -p o/tmp/ || exit
|
||||||
|
|
||||||
shineget() {
|
shineget() {
|
||||||
echo $2
|
echo $2
|
||||||
o//examples/curl.com $2 >o/tmp/$$ || exit
|
o//tool/curl/curl $2 >o/tmp/$$ || exit
|
||||||
mv o/tmp/$$ $1 || exit
|
mv o/tmp/$$ $1 || exit
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,8 +32,8 @@ COSMOPOLITAN_C_START_
|
||||||
/**
|
/**
|
||||||
* Declares benchmark function.
|
* Declares benchmark function.
|
||||||
*
|
*
|
||||||
* These only run if (1) the -b flag is passed to the FOO_test.com; and
|
* These only run if (1) the -b flag is passed to the FOO_test; and (2)
|
||||||
* (2) the unit tests passed. It's just an ordinary function, that gets
|
* the unit tests passed. It's just an ordinary function, that gets
|
||||||
* registered with the linker. It should print things to stdout.
|
* registered with the linker. It should print things to stdout.
|
||||||
*
|
*
|
||||||
* @see EZBENCH()
|
* @see EZBENCH()
|
||||||
|
|
|
@ -162,7 +162,7 @@ dontasan int main(int argc, char *argv[]) {
|
||||||
// we're done!
|
// we're done!
|
||||||
int status = MIN(255, g_testlib_failed);
|
int status = MIN(255, g_testlib_failed);
|
||||||
if (!status && IsRunningUnderMake()) {
|
if (!status && IsRunningUnderMake()) {
|
||||||
return 254; // compile.com considers this 0 and propagates output
|
return 254; // compile considers this 0 and propagates output
|
||||||
} else if (!status && _weaken(pthread_exit)) {
|
} else if (!status && _weaken(pthread_exit)) {
|
||||||
_weaken(pthread_exit)(0);
|
_weaken(pthread_exit)(0);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -81,10 +81,10 @@ void testlib_runtestcases(const testfn_t *start, const testfn_t *end,
|
||||||
// getpid() calls are inserted to help visually see tests in traces
|
// getpid() calls are inserted to help visually see tests in traces
|
||||||
// which can be performed on Linux, FreeBSD, OpenBSD, and XNU:
|
// which can be performed on Linux, FreeBSD, OpenBSD, and XNU:
|
||||||
//
|
//
|
||||||
// strace -f o/default/test.com |& less
|
// strace -f o/default/test |& less
|
||||||
// truss o/default/test.com |& less
|
// truss o/default/test |& less
|
||||||
// ktrace -f trace o/default/test.com </dev/null; kdump -f trace | less
|
// ktrace -f trace o/default/test </dev/null; kdump -f trace | less
|
||||||
// dtruss o/default/test.com |& less
|
// dtruss o/default/test |& less
|
||||||
//
|
//
|
||||||
// Test cases are iterable via a decentralized section. Your TEST()
|
// Test cases are iterable via a decentralized section. Your TEST()
|
||||||
// macro inserts .testcase.SUITENAME sections into the binary which
|
// macro inserts .testcase.SUITENAME sections into the binary which
|
||||||
|
|
|
@ -68,14 +68,6 @@ o/$(MODE)/net/turfwar/turfbean.com.dbg: \
|
||||||
$(APE_NO_MODIFY_SELF)
|
$(APE_NO_MODIFY_SELF)
|
||||||
@$(APELINK)
|
@$(APELINK)
|
||||||
|
|
||||||
o/$(MODE)/net/turfwar/turfbean.com: \
|
|
||||||
o/$(MODE)/net/turfwar/turfbean.com.dbg \
|
|
||||||
o/$(MODE)/third_party/zip/zip.com \
|
|
||||||
o/$(MODE)/tool/build/symtab.com
|
|
||||||
@$(MAKE_OBJCOPY)
|
|
||||||
@$(MAKE_SYMTAB_CREATE)
|
|
||||||
@$(MAKE_SYMTAB_ZIP)
|
|
||||||
|
|
||||||
o/$(MODE)/net/turfwar/.init.lua.zip.o: private \
|
o/$(MODE)/net/turfwar/.init.lua.zip.o: private \
|
||||||
ZIPOBJ_FLAGS += \
|
ZIPOBJ_FLAGS += \
|
||||||
-B
|
-B
|
||||||
|
|
|
@ -11,13 +11,13 @@ TEST_DSP_CORE_OBJS = \
|
||||||
$(TEST_DSP_CORE_SRCS:%.c=o/$(MODE)/%.o)
|
$(TEST_DSP_CORE_SRCS:%.c=o/$(MODE)/%.o)
|
||||||
|
|
||||||
TEST_DSP_CORE_COMS = \
|
TEST_DSP_CORE_COMS = \
|
||||||
$(TEST_DSP_CORE_SRCS:%.c=o/$(MODE)/%.com)
|
$(TEST_DSP_CORE_SRCS:%.c=o/$(MODE)/%)
|
||||||
|
|
||||||
TEST_DSP_CORE_TESTS = \
|
TEST_DSP_CORE_TESTS = \
|
||||||
$(TEST_DSP_CORE_SRCS_TEST:%.c=o/$(MODE)/%.com.ok)
|
$(TEST_DSP_CORE_SRCS_TEST:%.c=o/$(MODE)/%.ok)
|
||||||
|
|
||||||
TEST_DSP_CORE_CHECKS = \
|
TEST_DSP_CORE_CHECKS = \
|
||||||
$(TEST_DSP_CORE_SRCS_TEST:%.c=o/$(MODE)/%.com.runs)
|
$(TEST_DSP_CORE_SRCS_TEST:%.c=o/$(MODE)/%.runs)
|
||||||
|
|
||||||
TEST_DSP_CORE_DIRECTDEPS = \
|
TEST_DSP_CORE_DIRECTDEPS = \
|
||||||
DSP_CORE \
|
DSP_CORE \
|
||||||
|
@ -37,7 +37,7 @@ o/$(MODE)/test/dsp/core/core.pkg: \
|
||||||
$(TEST_DSP_CORE_OBJS) \
|
$(TEST_DSP_CORE_OBJS) \
|
||||||
$(foreach x,$(TEST_DSP_CORE_DIRECTDEPS),$($(x)_A).pkg)
|
$(foreach x,$(TEST_DSP_CORE_DIRECTDEPS),$($(x)_A).pkg)
|
||||||
|
|
||||||
o/$(MODE)/test/dsp/core/%.com.dbg: \
|
o/$(MODE)/test/dsp/core/%.dbg: \
|
||||||
$(TEST_DSP_CORE_DEPS) \
|
$(TEST_DSP_CORE_DEPS) \
|
||||||
o/$(MODE)/test/dsp/core/%.o \
|
o/$(MODE)/test/dsp/core/%.o \
|
||||||
$(LIBC_TESTMAIN) \
|
$(LIBC_TESTMAIN) \
|
||||||
|
|
|
@ -11,13 +11,13 @@ TEST_DSP_SCALE_OBJS = \
|
||||||
$(TEST_DSP_SCALE_SRCS:%.c=o/$(MODE)/%.o)
|
$(TEST_DSP_SCALE_SRCS:%.c=o/$(MODE)/%.o)
|
||||||
|
|
||||||
TEST_DSP_SCALE_COMS = \
|
TEST_DSP_SCALE_COMS = \
|
||||||
$(TEST_DSP_SCALE_SRCS:%.c=o/$(MODE)/%.com)
|
$(TEST_DSP_SCALE_SRCS:%.c=o/$(MODE)/%)
|
||||||
|
|
||||||
TEST_DSP_SCALE_TESTS = \
|
TEST_DSP_SCALE_TESTS = \
|
||||||
$(TEST_DSP_SCALE_SRCS_TEST:%.c=o/$(MODE)/%.com.ok)
|
$(TEST_DSP_SCALE_SRCS_TEST:%.c=o/$(MODE)/%.ok)
|
||||||
|
|
||||||
TEST_DSP_SCALE_CHECKS = \
|
TEST_DSP_SCALE_CHECKS = \
|
||||||
$(TEST_DSP_SCALE_SRCS_TEST:%.c=o/$(MODE)/%.com.runs)
|
$(TEST_DSP_SCALE_SRCS_TEST:%.c=o/$(MODE)/%.runs)
|
||||||
|
|
||||||
TEST_DSP_SCALE_DIRECTDEPS = \
|
TEST_DSP_SCALE_DIRECTDEPS = \
|
||||||
DSP_CORE \
|
DSP_CORE \
|
||||||
|
@ -42,7 +42,7 @@ o/$(MODE)/test/dsp/scale/scale.pkg: \
|
||||||
$(TEST_DSP_SCALE_OBJS) \
|
$(TEST_DSP_SCALE_OBJS) \
|
||||||
$(foreach x,$(TEST_DSP_SCALE_DIRECTDEPS),$($(x)_A).pkg)
|
$(foreach x,$(TEST_DSP_SCALE_DIRECTDEPS),$($(x)_A).pkg)
|
||||||
|
|
||||||
o/$(MODE)/test/dsp/scale/%.com.dbg: \
|
o/$(MODE)/test/dsp/scale/%.dbg: \
|
||||||
$(TEST_DSP_SCALE_DEPS) \
|
$(TEST_DSP_SCALE_DEPS) \
|
||||||
o/$(MODE)/test/dsp/scale/%.o \
|
o/$(MODE)/test/dsp/scale/%.o \
|
||||||
o/$(MODE)/test/dsp/scale/scale.pkg \
|
o/$(MODE)/test/dsp/scale/scale.pkg \
|
||||||
|
|
|
@ -11,13 +11,13 @@ TEST_DSP_TTY_OBJS = \
|
||||||
$(TEST_DSP_TTY_SRCS:%.c=o/$(MODE)/%.o)
|
$(TEST_DSP_TTY_SRCS:%.c=o/$(MODE)/%.o)
|
||||||
|
|
||||||
TEST_DSP_TTY_COMS = \
|
TEST_DSP_TTY_COMS = \
|
||||||
$(TEST_DSP_TTY_SRCS:%.c=o/$(MODE)/%.com)
|
$(TEST_DSP_TTY_SRCS:%.c=o/$(MODE)/%)
|
||||||
|
|
||||||
TEST_DSP_TTY_TESTS = \
|
TEST_DSP_TTY_TESTS = \
|
||||||
$(TEST_DSP_TTY_SRCS_TEST:%.c=o/$(MODE)/%.com.ok)
|
$(TEST_DSP_TTY_SRCS_TEST:%.c=o/$(MODE)/%.ok)
|
||||||
|
|
||||||
TEST_DSP_TTY_CHECKS = \
|
TEST_DSP_TTY_CHECKS = \
|
||||||
$(TEST_DSP_TTY_SRCS_TEST:%.c=o/$(MODE)/%.com.runs)
|
$(TEST_DSP_TTY_SRCS_TEST:%.c=o/$(MODE)/%.runs)
|
||||||
|
|
||||||
TEST_DSP_TTY_DIRECTDEPS = \
|
TEST_DSP_TTY_DIRECTDEPS = \
|
||||||
DSP_TTY \
|
DSP_TTY \
|
||||||
|
@ -38,7 +38,7 @@ o/$(MODE)/test/dsp/tty/tty.pkg: \
|
||||||
$(TEST_DSP_TTY_OBJS) \
|
$(TEST_DSP_TTY_OBJS) \
|
||||||
$(foreach x,$(TEST_DSP_TTY_DIRECTDEPS),$($(x)_A).pkg)
|
$(foreach x,$(TEST_DSP_TTY_DIRECTDEPS),$($(x)_A).pkg)
|
||||||
|
|
||||||
o/$(MODE)/test/dsp/tty/%.com.dbg: \
|
o/$(MODE)/test/dsp/tty/%.dbg: \
|
||||||
$(TEST_DSP_TTY_DEPS) \
|
$(TEST_DSP_TTY_DEPS) \
|
||||||
o/$(MODE)/test/dsp/tty/%.o \
|
o/$(MODE)/test/dsp/tty/%.o \
|
||||||
o/$(MODE)/test/dsp/tty/tty.pkg \
|
o/$(MODE)/test/dsp/tty/tty.pkg \
|
||||||
|
|
|
@ -13,21 +13,21 @@ TEST_LIBC_CALLS_OBJS = \
|
||||||
$(TEST_LIBC_CALLS_SRCS:%.c=o/$(MODE)/%.o)
|
$(TEST_LIBC_CALLS_SRCS:%.c=o/$(MODE)/%.o)
|
||||||
|
|
||||||
TEST_LIBC_CALLS_COMS = \
|
TEST_LIBC_CALLS_COMS = \
|
||||||
$(TEST_LIBC_CALLS_SRCS_TEST:%.c=o/$(MODE)/%.com)
|
$(TEST_LIBC_CALLS_SRCS_TEST:%.c=o/$(MODE)/%)
|
||||||
|
|
||||||
TEST_LIBC_CALLS_BINS = \
|
TEST_LIBC_CALLS_BINS = \
|
||||||
$(TEST_LIBC_CALLS_COMS) \
|
$(TEST_LIBC_CALLS_COMS) \
|
||||||
$(TEST_LIBC_CALLS_COMS:%=%.dbg) \
|
$(TEST_LIBC_CALLS_COMS:%=%.dbg) \
|
||||||
o/$(MODE)/test/libc/calls/life-nomod.com \
|
o/$(MODE)/test/libc/calls/life-nomod \
|
||||||
o/$(MODE)/test/libc/calls/life-classic.com \
|
o/$(MODE)/test/libc/calls/life-classic \
|
||||||
o/$(MODE)/test/libc/calls/zipread.com.dbg \
|
o/$(MODE)/test/libc/calls/zipread.dbg \
|
||||||
o/$(MODE)/test/libc/calls/zipread.com
|
o/$(MODE)/test/libc/calls/zipread
|
||||||
|
|
||||||
TEST_LIBC_CALLS_TESTS = \
|
TEST_LIBC_CALLS_TESTS = \
|
||||||
$(TEST_LIBC_CALLS_SRCS_TEST:%.c=o/$(MODE)/%.com.ok)
|
$(TEST_LIBC_CALLS_SRCS_TEST:%.c=o/$(MODE)/%.ok)
|
||||||
|
|
||||||
TEST_LIBC_CALLS_CHECKS = \
|
TEST_LIBC_CALLS_CHECKS = \
|
||||||
$(TEST_LIBC_CALLS_SRCS_TEST:%.c=o/$(MODE)/%.com.runs)
|
$(TEST_LIBC_CALLS_SRCS_TEST:%.c=o/$(MODE)/%.runs)
|
||||||
|
|
||||||
TEST_LIBC_CALLS_DIRECTDEPS = \
|
TEST_LIBC_CALLS_DIRECTDEPS = \
|
||||||
DSP_CORE \
|
DSP_CORE \
|
||||||
|
@ -61,7 +61,7 @@ o/$(MODE)/test/libc/calls/calls.pkg: \
|
||||||
$(TEST_LIBC_CALLS_OBJS) \
|
$(TEST_LIBC_CALLS_OBJS) \
|
||||||
$(foreach x,$(TEST_LIBC_CALLS_DIRECTDEPS),$($(x)_A).pkg)
|
$(foreach x,$(TEST_LIBC_CALLS_DIRECTDEPS),$($(x)_A).pkg)
|
||||||
|
|
||||||
o/$(MODE)/test/libc/calls/%.com.dbg: \
|
o/$(MODE)/test/libc/calls/%.dbg: \
|
||||||
$(TEST_LIBC_CALLS_DEPS) \
|
$(TEST_LIBC_CALLS_DEPS) \
|
||||||
o/$(MODE)/test/libc/calls/%.o \
|
o/$(MODE)/test/libc/calls/%.o \
|
||||||
o/$(MODE)/test/libc/calls/calls.pkg \
|
o/$(MODE)/test/libc/calls/calls.pkg \
|
||||||
|
@ -70,7 +70,7 @@ o/$(MODE)/test/libc/calls/%.com.dbg: \
|
||||||
$(APE_NO_MODIFY_SELF)
|
$(APE_NO_MODIFY_SELF)
|
||||||
@$(APELINK)
|
@$(APELINK)
|
||||||
|
|
||||||
o/$(MODE)/test/libc/calls/stat_test.com.dbg: \
|
o/$(MODE)/test/libc/calls/stat_test.dbg: \
|
||||||
$(TEST_LIBC_CALLS_DEPS) \
|
$(TEST_LIBC_CALLS_DEPS) \
|
||||||
o/$(MODE)/test/libc/calls/stat_test.o \
|
o/$(MODE)/test/libc/calls/stat_test.o \
|
||||||
o/$(MODE)/third_party/python/Lib/test/tokenize_tests-latin1-coding-cookie-and-utf8-bom-sig.txt.zip.o \
|
o/$(MODE)/third_party/python/Lib/test/tokenize_tests-latin1-coding-cookie-and-utf8-bom-sig.txt.zip.o \
|
||||||
|
@ -80,7 +80,7 @@ o/$(MODE)/test/libc/calls/stat_test.com.dbg: \
|
||||||
$(APE_NO_MODIFY_SELF)
|
$(APE_NO_MODIFY_SELF)
|
||||||
@$(APELINK)
|
@$(APELINK)
|
||||||
|
|
||||||
o/$(MODE)/test/libc/calls/unveil_test.com.dbg: \
|
o/$(MODE)/test/libc/calls/unveil_test.dbg: \
|
||||||
$(TEST_LIBC_CALLS_DEPS) \
|
$(TEST_LIBC_CALLS_DEPS) \
|
||||||
o/$(MODE)/test/libc/calls/unveil_test.o \
|
o/$(MODE)/test/libc/calls/unveil_test.o \
|
||||||
o/$(MODE)/test/libc/mem/prog/life.elf.zip.o \
|
o/$(MODE)/test/libc/mem/prog/life.elf.zip.o \
|
||||||
|
@ -91,7 +91,7 @@ o/$(MODE)/test/libc/calls/unveil_test.com.dbg: \
|
||||||
$(APE_NO_MODIFY_SELF)
|
$(APE_NO_MODIFY_SELF)
|
||||||
@$(APELINK)
|
@$(APELINK)
|
||||||
|
|
||||||
o/$(MODE)/test/libc/calls/pledge_test.com.dbg: \
|
o/$(MODE)/test/libc/calls/pledge_test.dbg: \
|
||||||
$(TEST_LIBC_CALLS_DEPS) \
|
$(TEST_LIBC_CALLS_DEPS) \
|
||||||
o/$(MODE)/test/libc/calls/pledge_test.o \
|
o/$(MODE)/test/libc/calls/pledge_test.o \
|
||||||
o/$(MODE)/test/libc/mem/prog/life.elf.zip.o \
|
o/$(MODE)/test/libc/mem/prog/life.elf.zip.o \
|
||||||
|
@ -102,14 +102,14 @@ o/$(MODE)/test/libc/calls/pledge_test.com.dbg: \
|
||||||
$(APE_NO_MODIFY_SELF)
|
$(APE_NO_MODIFY_SELF)
|
||||||
@$(APELINK)
|
@$(APELINK)
|
||||||
|
|
||||||
o/$(MODE)/test/libc/calls/life-classic.com.dbg: \
|
o/$(MODE)/test/libc/calls/life-classic.dbg: \
|
||||||
$(LIBC_RUNTIME) \
|
$(LIBC_RUNTIME) \
|
||||||
o/$(MODE)/test/libc/calls/life.o \
|
o/$(MODE)/test/libc/calls/life.o \
|
||||||
$(CRT) \
|
$(CRT) \
|
||||||
$(APE)
|
$(APE)
|
||||||
@$(APELINK)
|
@$(APELINK)
|
||||||
|
|
||||||
o/$(MODE)/test/libc/calls/life-nomod.com.dbg: \
|
o/$(MODE)/test/libc/calls/life-nomod.dbg: \
|
||||||
$(LIBC_RUNTIME) \
|
$(LIBC_RUNTIME) \
|
||||||
o/$(MODE)/test/libc/calls/life.o \
|
o/$(MODE)/test/libc/calls/life.o \
|
||||||
$(CRT) \
|
$(CRT) \
|
||||||
|
@ -117,43 +117,43 @@ o/$(MODE)/test/libc/calls/life-nomod.com.dbg: \
|
||||||
@$(APELINK)
|
@$(APELINK)
|
||||||
|
|
||||||
o/$(MODE)/test/libc/calls/tiny64.elf.zip.o \
|
o/$(MODE)/test/libc/calls/tiny64.elf.zip.o \
|
||||||
o/$(MODE)/test/libc/calls/life-nomod.com.zip.o \
|
o/$(MODE)/test/libc/calls/life-nomod.zip.o \
|
||||||
o/$(MODE)/test/libc/calls/life-classic.com.zip.o \
|
o/$(MODE)/test/libc/calls/life-classic.zip.o \
|
||||||
o/$(MODE)/test/libc/calls/zipread.com.zip.o: private \
|
o/$(MODE)/test/libc/calls/zipread.zip.o: private \
|
||||||
ZIPOBJ_FLAGS += \
|
ZIPOBJ_FLAGS += \
|
||||||
-B
|
-B
|
||||||
|
|
||||||
# TODO(jart): Have pledge() support SIOCGIFCONF
|
# TODO(jart): Have pledge() support SIOCGIFCONF
|
||||||
o/$(MODE)/test/libc/calls/ioctl_test.com.runs: \
|
o/$(MODE)/test/libc/calls/ioctl_test.runs: \
|
||||||
private .PLEDGE =
|
private .PLEDGE =
|
||||||
|
|
||||||
o/$(MODE)/test/libc/calls/lseek_test.com.runs \
|
o/$(MODE)/test/libc/calls/lseek_test.runs \
|
||||||
o/$(MODE)/test/libc/calls/poll_test.com.runs: \
|
o/$(MODE)/test/libc/calls/poll_test.runs: \
|
||||||
private .PLEDGE = stdio rpath wpath cpath fattr proc inet
|
private .PLEDGE = stdio rpath wpath cpath fattr proc inet
|
||||||
|
|
||||||
o/$(MODE)/test/libc/calls/fcntl_test.com.runs \
|
o/$(MODE)/test/libc/calls/fcntl_test.runs \
|
||||||
o/$(MODE)/test/libc/calls/lock_test.com.runs \
|
o/$(MODE)/test/libc/calls/lock_test.runs \
|
||||||
o/$(MODE)/test/libc/calls/lock2_test.com.runs \
|
o/$(MODE)/test/libc/calls/lock2_test.runs \
|
||||||
o/$(MODE)/test/libc/calls/lock_ofd_test.com.runs: \
|
o/$(MODE)/test/libc/calls/lock_ofd_test.runs: \
|
||||||
private .PLEDGE = stdio rpath wpath cpath fattr proc flock
|
private .PLEDGE = stdio rpath wpath cpath fattr proc flock
|
||||||
|
|
||||||
o/$(MODE)/test/libc/calls/unveil_test.com.runs \
|
o/$(MODE)/test/libc/calls/unveil_test.runs \
|
||||||
o/$(MODE)/test/libc/calls/openbsd_test.com.runs: \
|
o/$(MODE)/test/libc/calls/openbsd_test.runs: \
|
||||||
private .PLEDGE = stdio rpath wpath cpath fattr proc unveil
|
private .PLEDGE = stdio rpath wpath cpath fattr proc unveil
|
||||||
|
|
||||||
o/$(MODE)/test/libc/calls/fexecve_test.com.runs: \
|
o/$(MODE)/test/libc/calls/fexecve_test.runs: \
|
||||||
private .UNSANDBOXED = 1 # for memfd_create()
|
private .UNSANDBOXED = 1 # for memfd_create()
|
||||||
|
|
||||||
o/$(MODE)/test/libc/calls/execve_test.com.runs: \
|
o/$(MODE)/test/libc/calls/execve_test.runs: \
|
||||||
private .UNSANDBOXED = 1 # for memfd_create()
|
private .UNSANDBOXED = 1 # for memfd_create()
|
||||||
|
|
||||||
o/$(MODE)/test/libc/calls/read_test.com.runs: \
|
o/$(MODE)/test/libc/calls/read_test.runs: \
|
||||||
private .UNVEIL += /dev/zero
|
private .UNVEIL += /dev/zero
|
||||||
|
|
||||||
# TODO(jart): Update nointernet() to allow AF_INET6
|
# TODO(jart): Update nointernet() to allow AF_INET6
|
||||||
o/$(MODE)/test/libc/calls/pledge_test.com.runs: \
|
o/$(MODE)/test/libc/calls/pledge_test.runs: \
|
||||||
private .INTERNET = 1
|
private .INTERNET = 1
|
||||||
o/$(MODE)/test/libc/calls/pledge_test.com.runs: \
|
o/$(MODE)/test/libc/calls/pledge_test.runs: \
|
||||||
private .PLEDGE =
|
private .PLEDGE =
|
||||||
|
|
||||||
.PHONY: o/$(MODE)/test/libc/calls
|
.PHONY: o/$(MODE)/test/libc/calls
|
||||||
|
|
|
@ -55,35 +55,34 @@ TEST(commandv, testPathSearch) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(commandv, testSlashes_wontSearchPath_butChecksAccess) {
|
TEST(commandv, testSlashes_wontSearchPath_butChecksAccess) {
|
||||||
EXPECT_SYS(0, 3, creat("home/sh.com", 0755));
|
EXPECT_SYS(0, 3, creat("home/sh", 0755));
|
||||||
EXPECT_SYS(0, 2, write(3, "MZ", 2));
|
EXPECT_SYS(0, 2, write(3, "MZ", 2));
|
||||||
EXPECT_SYS(0, 0, close(3));
|
EXPECT_SYS(0, 0, close(3));
|
||||||
EXPECT_STREQ("home/sh.com",
|
EXPECT_STREQ("home/sh", commandv("home/sh", pathbuf, sizeof(pathbuf)));
|
||||||
commandv("home/sh.com", pathbuf, sizeof(pathbuf)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(commandv, testSameDir_doesntHappenByDefaultUnlessItsWindows) {
|
TEST(commandv, testSameDir_doesntHappenByDefaultUnlessItsWindows) {
|
||||||
EXPECT_SYS(0, 3, creat("bog.com", 0755));
|
EXPECT_SYS(0, 3, creat("bog", 0755));
|
||||||
EXPECT_SYS(0, 2, write(3, "MZ", 2));
|
EXPECT_SYS(0, 2, write(3, "MZ", 2));
|
||||||
EXPECT_SYS(0, 0, close(3));
|
EXPECT_SYS(0, 0, close(3));
|
||||||
EXPECT_STREQ(NULL, commandv("bog.com", pathbuf, sizeof(pathbuf)));
|
EXPECT_STREQ(NULL, commandv("bog", pathbuf, sizeof(pathbuf)));
|
||||||
EXPECT_EQ(ENOENT, errno);
|
EXPECT_EQ(ENOENT, errno);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(commandv, testSameDir_willHappenWithColonBlank) {
|
TEST(commandv, testSameDir_willHappenWithColonBlank) {
|
||||||
ASSERT_NE(-1, setenv("PATH", "bin:", true));
|
ASSERT_NE(-1, setenv("PATH", "bin:", true));
|
||||||
EXPECT_SYS(0, 3, creat("bog.com", 0755));
|
EXPECT_SYS(0, 3, creat("bog", 0755));
|
||||||
EXPECT_SYS(0, 2, write(3, "MZ", 2));
|
EXPECT_SYS(0, 2, write(3, "MZ", 2));
|
||||||
EXPECT_SYS(0, 0, close(3));
|
EXPECT_SYS(0, 0, close(3));
|
||||||
EXPECT_STREQ("bog.com", commandv("bog.com", pathbuf, sizeof(pathbuf)));
|
EXPECT_STREQ("bog", commandv("bog", pathbuf, sizeof(pathbuf)));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(commandv, testSameDir_willHappenWithColonBlank2) {
|
TEST(commandv, testSameDir_willHappenWithColonBlank2) {
|
||||||
ASSERT_NE(-1, setenv("PATH", ":bin", true));
|
ASSERT_NE(-1, setenv("PATH", ":bin", true));
|
||||||
EXPECT_SYS(0, 3, creat("bog.com", 0755));
|
EXPECT_SYS(0, 3, creat("bog", 0755));
|
||||||
EXPECT_SYS(0, 2, write(3, "MZ", 2));
|
EXPECT_SYS(0, 2, write(3, "MZ", 2));
|
||||||
EXPECT_SYS(0, 0, close(3));
|
EXPECT_SYS(0, 0, close(3));
|
||||||
EXPECT_STREQ("bog.com", commandv("bog.com", pathbuf, sizeof(pathbuf)));
|
EXPECT_STREQ("bog", commandv("bog", pathbuf, sizeof(pathbuf)));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(commandv, test_DirPaths_wontConsiderDirectoriesExecutable) {
|
TEST(commandv, test_DirPaths_wontConsiderDirectoriesExecutable) {
|
||||||
|
@ -95,9 +94,8 @@ TEST(commandv, test_DirPaths_wontConsiderDirectoriesExecutable) {
|
||||||
|
|
||||||
TEST(commandv, test_DirPaths_wontConsiderDirectoriesExecutable2) {
|
TEST(commandv, test_DirPaths_wontConsiderDirectoriesExecutable2) {
|
||||||
ASSERT_NE(-1, setenv("PATH", ":bin", true));
|
ASSERT_NE(-1, setenv("PATH", ":bin", true));
|
||||||
EXPECT_SYS(0, 0, mkdir("this_is_a_directory.com", 0755));
|
EXPECT_SYS(0, 0, mkdir("this_is_a_directory", 0755));
|
||||||
EXPECT_STREQ(NULL,
|
EXPECT_STREQ(NULL, commandv("this_is_a_directory", pathbuf, sizeof(pathbuf)));
|
||||||
commandv("this_is_a_directory.com", pathbuf, sizeof(pathbuf)));
|
|
||||||
EXPECT_EQ(ENOENT, errno);
|
EXPECT_EQ(ENOENT, errno);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -124,7 +124,7 @@ TEST(GetProgramExecutableName, movedSelf) {
|
||||||
if (skiptests) return;
|
if (skiptests) return;
|
||||||
if (IsAarch64() && IsQemuUser()) {
|
if (IsAarch64() && IsQemuUser()) {
|
||||||
// clang-format off
|
// clang-format off
|
||||||
// TODO(mrdomino): fix: make -j8 m=aarch64 o/aarch64/test/libc/calls/getprogramexecutablename_test.com.ok
|
// TODO(mrdomino): fix: make -j8 m=aarch64 o/aarch64/test/libc/calls/getprogramexecutablename_test.ok
|
||||||
// possibly related to the intersection of binfmt_misc and qemu-aarch64
|
// possibly related to the intersection of binfmt_misc and qemu-aarch64
|
||||||
// clang-format on
|
// clang-format on
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -85,9 +85,9 @@ TEST(mkntcmdline, fixit) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(mkntcmdline, testWut) {
|
TEST(mkntcmdline, testWut) {
|
||||||
char *argv[] = {"C:\\Users\\jart\\𝑟𝑒𝑑𝑏𝑒𝑎𝑛.com", "--strace", NULL};
|
char *argv[] = {"C:\\Users\\jart\\𝑟𝑒𝑑𝑏𝑒𝑎𝑛", "--strace", NULL};
|
||||||
EXPECT_NE(-1, mkntcmdline(cmdline, argv));
|
EXPECT_NE(-1, mkntcmdline(cmdline, argv));
|
||||||
EXPECT_STREQ(u"C:\\Users\\jart\\𝑟𝑒𝑑𝑏𝑒𝑎𝑛.com --strace", cmdline);
|
EXPECT_STREQ(u"C:\\Users\\jart\\𝑟𝑒𝑑𝑏𝑒𝑎𝑛 --strace", cmdline);
|
||||||
}
|
}
|
||||||
|
|
||||||
BENCH(mkntcmdline, lotsOfArgs) {
|
BENCH(mkntcmdline, lotsOfArgs) {
|
||||||
|
|
|
@ -37,8 +37,8 @@ TEST(mkntpath, testSlashes) {
|
||||||
* all it takes to make the feature entirely useless to us, similar to
|
* all it takes to make the feature entirely useless to us, similar to
|
||||||
* the law of noncontradiction. We address the issue as follows:
|
* the law of noncontradiction. We address the issue as follows:
|
||||||
*/
|
*/
|
||||||
EXPECT_EQ(9, __mkntpath("o/foo.com", p));
|
EXPECT_EQ(5, __mkntpath("o/foo", p));
|
||||||
EXPECT_STREQ(u"o\\foo.com", p);
|
EXPECT_STREQ(u"o\\foo", p);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(mkntpath, testUnicode) {
|
TEST(mkntpath, testUnicode) {
|
||||||
|
|
|
@ -6,58 +6,58 @@ PKGS += TEST_LIBC_FMT
|
||||||
TEST_LIBC_FMT_SRCS := $(wildcard test/libc/fmt/*.c)
|
TEST_LIBC_FMT_SRCS := $(wildcard test/libc/fmt/*.c)
|
||||||
TEST_LIBC_FMT_SRCS_TEST = $(filter %_test.c,$(TEST_LIBC_FMT_SRCS))
|
TEST_LIBC_FMT_SRCS_TEST = $(filter %_test.c,$(TEST_LIBC_FMT_SRCS))
|
||||||
TEST_LIBC_FMT_BINS = $(TEST_LIBC_FMT_COMS) $(TEST_LIBC_FMT_COMS:%=%.dbg)
|
TEST_LIBC_FMT_BINS = $(TEST_LIBC_FMT_COMS) $(TEST_LIBC_FMT_COMS:%=%.dbg)
|
||||||
TEST_LIBC_FMT_TESTS = $(TEST_LIBC_FMT_SRCS_TEST:%.c=o/$(MODE)/%.com.ok)
|
TEST_LIBC_FMT_TESTS = $(TEST_LIBC_FMT_SRCS_TEST:%.c=o/$(MODE)/%.ok)
|
||||||
|
|
||||||
TEST_LIBC_FMT_OBJS = \
|
TEST_LIBC_FMT_OBJS = \
|
||||||
$(TEST_LIBC_FMT_SRCS:%.c=o/$(MODE)/%.o)
|
$(TEST_LIBC_FMT_SRCS:%.c=o/$(MODE)/%.o)
|
||||||
|
|
||||||
TEST_LIBC_FMT_COMS = \
|
TEST_LIBC_FMT_COMS = \
|
||||||
$(TEST_LIBC_FMT_SRCS:%.c=o/$(MODE)/%.com)
|
$(TEST_LIBC_FMT_SRCS:%.c=o/$(MODE)/%)
|
||||||
|
|
||||||
TEST_LIBC_FMT_CHECKS = \
|
TEST_LIBC_FMT_CHECKS = \
|
||||||
$(TEST_LIBC_FMT_SRCS_TEST:%.c=o/$(MODE)/%.com.runs)
|
$(TEST_LIBC_FMT_SRCS_TEST:%.c=o/$(MODE)/%.runs)
|
||||||
|
|
||||||
TEST_LIBC_FMT_DIRECTDEPS = \
|
TEST_LIBC_FMT_DIRECTDEPS = \
|
||||||
LIBC_FMT \
|
LIBC_FMT \
|
||||||
LIBC_INTRIN \
|
LIBC_INTRIN \
|
||||||
LIBC_LOG \
|
LIBC_LOG \
|
||||||
LIBC_MEM \
|
LIBC_MEM \
|
||||||
LIBC_NEXGEN32E \
|
LIBC_NEXGEN32E \
|
||||||
LIBC_RUNTIME \
|
LIBC_RUNTIME \
|
||||||
LIBC_STDIO \
|
LIBC_STDIO \
|
||||||
LIBC_STR \
|
LIBC_STR \
|
||||||
LIBC_SYSV \
|
LIBC_SYSV \
|
||||||
LIBC_TESTLIB \
|
LIBC_TESTLIB \
|
||||||
LIBC_TINYMATH \
|
LIBC_TINYMATH \
|
||||||
LIBC_X \
|
LIBC_X \
|
||||||
THIRD_PARTY_GDTOA
|
THIRD_PARTY_GDTOA
|
||||||
|
|
||||||
TEST_LIBC_FMT_DEPS := \
|
TEST_LIBC_FMT_DEPS := \
|
||||||
$(call uniq,$(foreach x,$(TEST_LIBC_FMT_DIRECTDEPS),$($(x))))
|
$(call uniq,$(foreach x,$(TEST_LIBC_FMT_DIRECTDEPS),$($(x))))
|
||||||
|
|
||||||
o/$(MODE)/test/libc/fmt/fmt.pkg: \
|
o/$(MODE)/test/libc/fmt/fmt.pkg: \
|
||||||
$(TEST_LIBC_FMT_OBJS) \
|
$(TEST_LIBC_FMT_OBJS) \
|
||||||
$(foreach x,$(TEST_LIBC_FMT_DIRECTDEPS),$($(x)_A).pkg)
|
$(foreach x,$(TEST_LIBC_FMT_DIRECTDEPS),$($(x)_A).pkg)
|
||||||
|
|
||||||
o/$(MODE)/test/libc/fmt/%.com.dbg: \
|
o/$(MODE)/test/libc/fmt/%.dbg: \
|
||||||
$(TEST_LIBC_FMT_DEPS) \
|
$(TEST_LIBC_FMT_DEPS) \
|
||||||
o/$(MODE)/test/libc/fmt/%.o \
|
o/$(MODE)/test/libc/fmt/%.o \
|
||||||
o/$(MODE)/test/libc/fmt/fmt.pkg \
|
o/$(MODE)/test/libc/fmt/fmt.pkg \
|
||||||
$(LIBC_TESTMAIN) \
|
$(LIBC_TESTMAIN) \
|
||||||
$(CRT) \
|
$(CRT) \
|
||||||
$(APE_NO_MODIFY_SELF)
|
$(APE_NO_MODIFY_SELF)
|
||||||
@$(APELINK)
|
@$(APELINK)
|
||||||
|
|
||||||
$(TEST_LIBC_FMT_OBJS): test/libc/fmt/BUILD.mk
|
$(TEST_LIBC_FMT_OBJS): test/libc/fmt/BUILD.mk
|
||||||
|
|
||||||
$(TEST_LIBC_FMT_OBJS): private \
|
$(TEST_LIBC_FMT_OBJS): private \
|
||||||
DEFAULT_CCFLAGS += \
|
DEFAULT_CCFLAGS += \
|
||||||
-fno-builtin
|
-fno-builtin
|
||||||
|
|
||||||
o/$(MODE)/test/libc/fmt/fprintf_test.com.runs: \
|
o/$(MODE)/test/libc/fmt/fprintf_test.runs: \
|
||||||
private .UNVEIL += w:/dev/full
|
private .UNVEIL += w:/dev/full
|
||||||
|
|
||||||
.PHONY: o/$(MODE)/test/libc/fmt
|
.PHONY: o/$(MODE)/test/libc/fmt
|
||||||
o/$(MODE)/test/libc/fmt: \
|
o/$(MODE)/test/libc/fmt: \
|
||||||
$(TEST_LIBC_FMT_BINS) \
|
$(TEST_LIBC_FMT_BINS) \
|
||||||
$(TEST_LIBC_FMT_CHECKS)
|
$(TEST_LIBC_FMT_CHECKS)
|
||||||
|
|
|
@ -23,19 +23,19 @@
|
||||||
#include "libc/x/x.h"
|
#include "libc/x/x.h"
|
||||||
|
|
||||||
TEST(stripexts, test) {
|
TEST(stripexts, test) {
|
||||||
char s[] = "foo/bar.com.dbg";
|
char s[] = "foo/bar.dbg";
|
||||||
EXPECT_STREQ("foo/bar", stripexts(s));
|
EXPECT_STREQ("foo/bar", stripexts(s));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(stripexts, test2) {
|
TEST(stripexts, test2) {
|
||||||
char s[] = "foo/bar.com.dbg";
|
char s[] = "foo/bar.dbg";
|
||||||
EXPECT_STREQ("bar", stripexts(basename(s)));
|
EXPECT_STREQ("bar", stripexts(basename(s)));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(xstripexts, test) {
|
TEST(xstripexts, test) {
|
||||||
EXPECT_STREQ("foo/bar", gc(xstripexts("foo/bar.com.dbg")));
|
EXPECT_STREQ("foo/bar", gc(xstripexts("foo/bar.dbg")));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(xstripexts, test2) {
|
TEST(xstripexts, test2) {
|
||||||
EXPECT_STREQ("bar", gc(xstripexts(basename("foo/bar.com.dbg"))));
|
EXPECT_STREQ("bar", gc(xstripexts(basename("foo/bar.dbg"))));
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,17 +10,17 @@ TEST_LIBC_INTRIN_OBJS = \
|
||||||
$(TEST_LIBC_INTRIN_SRCS:%.c=o/$(MODE)/%.o)
|
$(TEST_LIBC_INTRIN_SRCS:%.c=o/$(MODE)/%.o)
|
||||||
|
|
||||||
TEST_LIBC_INTRIN_COMS = \
|
TEST_LIBC_INTRIN_COMS = \
|
||||||
$(TEST_LIBC_INTRIN_SRCS:%.c=o/$(MODE)/%.com)
|
$(TEST_LIBC_INTRIN_SRCS:%.c=o/$(MODE)/%)
|
||||||
|
|
||||||
TEST_LIBC_INTRIN_BINS = \
|
TEST_LIBC_INTRIN_BINS = \
|
||||||
$(TEST_LIBC_INTRIN_COMS) \
|
$(TEST_LIBC_INTRIN_COMS) \
|
||||||
$(TEST_LIBC_INTRIN_COMS:%=%.dbg)
|
$(TEST_LIBC_INTRIN_COMS:%=%.dbg)
|
||||||
|
|
||||||
TEST_LIBC_INTRIN_TESTS = \
|
TEST_LIBC_INTRIN_TESTS = \
|
||||||
$(TEST_LIBC_INTRIN_SRCS_TEST:%.c=o/$(MODE)/%.com.ok)
|
$(TEST_LIBC_INTRIN_SRCS_TEST:%.c=o/$(MODE)/%.ok)
|
||||||
|
|
||||||
TEST_LIBC_INTRIN_CHECKS = \
|
TEST_LIBC_INTRIN_CHECKS = \
|
||||||
$(TEST_LIBC_INTRIN_SRCS_TEST:%.c=o/$(MODE)/%.com.runs)
|
$(TEST_LIBC_INTRIN_SRCS_TEST:%.c=o/$(MODE)/%.runs)
|
||||||
|
|
||||||
TEST_LIBC_INTRIN_DIRECTDEPS = \
|
TEST_LIBC_INTRIN_DIRECTDEPS = \
|
||||||
LIBC_CALLS \
|
LIBC_CALLS \
|
||||||
|
@ -50,7 +50,7 @@ o/$(MODE)/test/libc/intrin/intrin.pkg: \
|
||||||
$(TEST_LIBC_INTRIN_OBJS) \
|
$(TEST_LIBC_INTRIN_OBJS) \
|
||||||
$(foreach x,$(TEST_LIBC_INTRIN_DIRECTDEPS),$($(x)_A).pkg)
|
$(foreach x,$(TEST_LIBC_INTRIN_DIRECTDEPS),$($(x)_A).pkg)
|
||||||
|
|
||||||
o/$(MODE)/test/libc/intrin/%.com.dbg: \
|
o/$(MODE)/test/libc/intrin/%.dbg: \
|
||||||
$(TEST_LIBC_INTRIN_DEPS) \
|
$(TEST_LIBC_INTRIN_DEPS) \
|
||||||
o/$(MODE)/test/libc/intrin/%.o \
|
o/$(MODE)/test/libc/intrin/%.o \
|
||||||
o/$(MODE)/test/libc/intrin/intrin.pkg \
|
o/$(MODE)/test/libc/intrin/intrin.pkg \
|
||||||
|
@ -60,7 +60,7 @@ o/$(MODE)/test/libc/intrin/%.com.dbg: \
|
||||||
@$(APELINK)
|
@$(APELINK)
|
||||||
|
|
||||||
# Test what happens when *NSYNC isn't linked.
|
# Test what happens when *NSYNC isn't linked.
|
||||||
o/$(MODE)/test/libc/intrin/lock_test.com.dbg: \
|
o/$(MODE)/test/libc/intrin/lock_test.dbg: \
|
||||||
$(TEST_LIBC_INTRIN_DEPS) \
|
$(TEST_LIBC_INTRIN_DEPS) \
|
||||||
o/$(MODE)/test/libc/intrin/lock_test.o \
|
o/$(MODE)/test/libc/intrin/lock_test.o \
|
||||||
o/$(MODE)/test/libc/intrin/intrin.pkg \
|
o/$(MODE)/test/libc/intrin/intrin.pkg \
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
*
|
*
|
||||||
* This test can be run as follows:
|
* This test can be run as follows:
|
||||||
*
|
*
|
||||||
* make o//test/libc/intrin/lockscale_test.com.runs V=5 TESTARGS=-b
|
* make o//test/libc/intrin/lockscale_test.runs V=5 TESTARGS=-b
|
||||||
*
|
*
|
||||||
* It's intended to demonstrate the importance of futexes. On systems
|
* It's intended to demonstrate the importance of futexes. On systems
|
||||||
* that don't have them, this test consumes orders of a magnitude more
|
* that don't have them, this test consumes orders of a magnitude more
|
||||||
|
|
|
@ -8,21 +8,21 @@ TEST_LIBC_LOG_SRCS_TEST = $(filter %_test.c,$(TEST_LIBC_LOG_SRCS))
|
||||||
|
|
||||||
TEST_LIBC_LOG_OBJS = \
|
TEST_LIBC_LOG_OBJS = \
|
||||||
$(TEST_LIBC_LOG_SRCS:%.c=o/$(MODE)/%.o) \
|
$(TEST_LIBC_LOG_SRCS:%.c=o/$(MODE)/%.o) \
|
||||||
o/$(MODE)/test/libc/log/backtrace.com.zip.o \
|
o/$(MODE)/test/libc/log/backtrace.zip.o \
|
||||||
o/$(MODE)/test/libc/log/backtrace.com.dbg.zip.o
|
o/$(MODE)/test/libc/log/backtrace.dbg.zip.o
|
||||||
|
|
||||||
TEST_LIBC_LOG_COMS = \
|
TEST_LIBC_LOG_COMS = \
|
||||||
$(TEST_LIBC_LOG_SRCS:%.c=o/$(MODE)/%.com)
|
$(TEST_LIBC_LOG_SRCS:%.c=o/$(MODE)/%)
|
||||||
|
|
||||||
TEST_LIBC_LOG_BINS = \
|
TEST_LIBC_LOG_BINS = \
|
||||||
$(TEST_LIBC_LOG_COMS) \
|
$(TEST_LIBC_LOG_COMS) \
|
||||||
$(TEST_LIBC_LOG_COMS:%=%.dbg)
|
$(TEST_LIBC_LOG_COMS:%=%.dbg)
|
||||||
|
|
||||||
TEST_LIBC_LOG_TESTS = \
|
TEST_LIBC_LOG_TESTS = \
|
||||||
$(TEST_LIBC_LOG_SRCS_TEST:%.c=o/$(MODE)/%.com.ok)
|
$(TEST_LIBC_LOG_SRCS_TEST:%.c=o/$(MODE)/%.ok)
|
||||||
|
|
||||||
TEST_LIBC_LOG_CHECKS = \
|
TEST_LIBC_LOG_CHECKS = \
|
||||||
$(TEST_LIBC_LOG_SRCS_TEST:%.c=o/$(MODE)/%.com.runs)
|
$(TEST_LIBC_LOG_SRCS_TEST:%.c=o/$(MODE)/%.runs)
|
||||||
|
|
||||||
TEST_LIBC_LOG_DIRECTDEPS = \
|
TEST_LIBC_LOG_DIRECTDEPS = \
|
||||||
LIBC_CALLS \
|
LIBC_CALLS \
|
||||||
|
@ -47,7 +47,7 @@ o/$(MODE)/test/libc/log/log.pkg: \
|
||||||
$(TEST_LIBC_LOG_OBJS) \
|
$(TEST_LIBC_LOG_OBJS) \
|
||||||
$(foreach x,$(TEST_LIBC_LOG_DIRECTDEPS),$($(x)_A).pkg)
|
$(foreach x,$(TEST_LIBC_LOG_DIRECTDEPS),$($(x)_A).pkg)
|
||||||
|
|
||||||
o/$(MODE)/test/libc/log/%.com.dbg: \
|
o/$(MODE)/test/libc/log/%.dbg: \
|
||||||
$(TEST_LIBC_LOG_DEPS) \
|
$(TEST_LIBC_LOG_DEPS) \
|
||||||
o/$(MODE)/test/libc/log/%.o \
|
o/$(MODE)/test/libc/log/%.o \
|
||||||
o/$(MODE)/test/libc/log/log.pkg \
|
o/$(MODE)/test/libc/log/log.pkg \
|
||||||
|
@ -56,10 +56,10 @@ o/$(MODE)/test/libc/log/%.com.dbg: \
|
||||||
$(APE_NO_MODIFY_SELF)
|
$(APE_NO_MODIFY_SELF)
|
||||||
@$(APELINK)
|
@$(APELINK)
|
||||||
|
|
||||||
o/$(MODE)/test/libc/log/backtrace_test.com.dbg: \
|
o/$(MODE)/test/libc/log/backtrace_test.dbg: \
|
||||||
$(TEST_LIBC_LOG_DEPS) \
|
$(TEST_LIBC_LOG_DEPS) \
|
||||||
o/$(MODE)/test/libc/log/backtrace.com.zip.o \
|
o/$(MODE)/test/libc/log/backtrace.zip.o \
|
||||||
o/$(MODE)/test/libc/log/backtrace.com.dbg.zip.o \
|
o/$(MODE)/test/libc/log/backtrace.dbg.zip.o \
|
||||||
o/$(MODE)/test/libc/log/backtrace_test.o \
|
o/$(MODE)/test/libc/log/backtrace_test.o \
|
||||||
o/$(MODE)/test/libc/log/log.pkg \
|
o/$(MODE)/test/libc/log/log.pkg \
|
||||||
$(LIBC_TESTMAIN) \
|
$(LIBC_TESTMAIN) \
|
||||||
|
@ -67,15 +67,15 @@ o/$(MODE)/test/libc/log/backtrace_test.com.dbg: \
|
||||||
$(APE_NO_MODIFY_SELF)
|
$(APE_NO_MODIFY_SELF)
|
||||||
@$(APELINK)
|
@$(APELINK)
|
||||||
|
|
||||||
o/$(MODE)/test/libc/log/backtrace.com.dbg: \
|
o/$(MODE)/test/libc/log/backtrace.dbg: \
|
||||||
$(TEST_LIBC_LOG_DEPS) \
|
$(TEST_LIBC_LOG_DEPS) \
|
||||||
o/$(MODE)/test/libc/log/backtrace.o \
|
o/$(MODE)/test/libc/log/backtrace.o \
|
||||||
$(CRT) \
|
$(CRT) \
|
||||||
$(APE_NO_MODIFY_SELF)
|
$(APE_NO_MODIFY_SELF)
|
||||||
@$(APELINK)
|
@$(APELINK)
|
||||||
|
|
||||||
o/$(MODE)/test/libc/log/backtrace.com.zip.o \
|
o/$(MODE)/test/libc/log/backtrace.zip.o \
|
||||||
o/$(MODE)/test/libc/log/backtrace.com.dbg.zip.o: private \
|
o/$(MODE)/test/libc/log/backtrace.dbg.zip.o: private \
|
||||||
ZIPOBJ_FLAGS += \
|
ZIPOBJ_FLAGS += \
|
||||||
-B
|
-B
|
||||||
|
|
||||||
|
|
|
@ -41,14 +41,14 @@
|
||||||
#ifdef __x86_64__
|
#ifdef __x86_64__
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
__static_yoink("backtrace.com");
|
__static_yoink("backtrace");
|
||||||
__static_yoink("backtrace.com.dbg");
|
__static_yoink("backtrace.dbg");
|
||||||
|
|
||||||
void SetUpOnce(void) {
|
void SetUpOnce(void) {
|
||||||
testlib_enable_tmp_setup_teardown_once();
|
testlib_enable_tmp_setup_teardown_once();
|
||||||
ASSERT_NE(-1, mkdir("bin", 0755));
|
ASSERT_NE(-1, mkdir("bin", 0755));
|
||||||
testlib_extract("/zip/backtrace.com", "bin/backtrace.com", 0755);
|
testlib_extract("/zip/backtrace", "bin/backtrace", 0755);
|
||||||
testlib_extract("/zip/backtrace.com.dbg", "bin/backtrace.com.dbg", 0755);
|
testlib_extract("/zip/backtrace.dbg", "bin/backtrace.dbg", 0755);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool OutputHasSymbol(const char *output, const char *s) {
|
static bool OutputHasSymbol(const char *output, const char *s) {
|
||||||
|
@ -56,7 +56,7 @@ static bool OutputHasSymbol(const char *output, const char *s) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// UNFREED MEMORY
|
// UNFREED MEMORY
|
||||||
// o/dbg/test/libc/log/backtrace_test.com
|
// o/dbg/test/libc/log/backtrace_test
|
||||||
// max allocated space 655,360
|
// max allocated space 655,360
|
||||||
// total allocated space 80
|
// total allocated space 80
|
||||||
// total free space 327,600
|
// total free space 327,600
|
||||||
|
@ -95,7 +95,7 @@ TEST(ShowCrashReports, testMemoryLeakCrash) {
|
||||||
if (!pid) {
|
if (!pid) {
|
||||||
dup2(fds[1], 1);
|
dup2(fds[1], 1);
|
||||||
dup2(fds[1], 2);
|
dup2(fds[1], 2);
|
||||||
execv("bin/backtrace.com", (char *const[]){"bin/backtrace.com", "6", 0});
|
execv("bin/backtrace", (char *const[]){"bin/backtrace", "6", 0});
|
||||||
_Exit(127);
|
_Exit(127);
|
||||||
}
|
}
|
||||||
close(fds[1]);
|
close(fds[1]);
|
||||||
|
@ -126,7 +126,7 @@ TEST(ShowCrashReports, testMemoryLeakCrash) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// error: Uncaught SIGFPE (FPE_INTDIV) on nightmare pid 11724
|
// error: Uncaught SIGFPE (FPE_INTDIV) on nightmare pid 11724
|
||||||
// /home/jart/cosmo/o/dbg/test/libc/log/backtrace_test.com.tmp.11721
|
// /home/jart/cosmo/o/dbg/test/libc/log/backtrace_test.tmp.11721
|
||||||
// ENOTTY[25]
|
// ENOTTY[25]
|
||||||
// Linux nightmare SMP Thu, 12 Aug 2021 06:16:45 UTC
|
// Linux nightmare SMP Thu, 12 Aug 2021 06:16:45 UTC
|
||||||
//
|
//
|
||||||
|
@ -164,9 +164,9 @@ TEST(ShowCrashReports, testMemoryLeakCrash) {
|
||||||
// /* 22 frames mapped w/ 1,879,015,395 frames gapped */
|
// /* 22 frames mapped w/ 1,879,015,395 frames gapped */
|
||||||
//
|
//
|
||||||
// 00400000-0045b000 r-xp 00000000 08:03 4587526
|
// 00400000-0045b000 r-xp 00000000 08:03 4587526
|
||||||
// /home/jart/cosmo/o/dbg/test/libc/log/backtrace_test.com.tmp.11721
|
// /home/jart/cosmo/o/dbg/test/libc/log/backtrace_test.tmp.11721
|
||||||
// 0045b000-00461000 rw-p 0005b000 08:03 4587526
|
// 0045b000-00461000 rw-p 0005b000 08:03 4587526
|
||||||
// /home/jart/cosmo/o/dbg/test/libc/log/backtrace_test.com.tmp.11721
|
// /home/jart/cosmo/o/dbg/test/libc/log/backtrace_test.tmp.11721
|
||||||
// 00461000-004a0000 rw-p 00000000 00:00 0
|
// 00461000-004a0000 rw-p 00000000 00:00 0
|
||||||
// 80070000-80090000 rw-p 00000000 00:00 0
|
// 80070000-80090000 rw-p 00000000 00:00 0
|
||||||
// e007ffd0000-e0080000000 rw-p 00000000 00:00 0
|
// e007ffd0000-e0080000000 rw-p 00000000 00:00 0
|
||||||
|
@ -176,7 +176,7 @@ TEST(ShowCrashReports, testMemoryLeakCrash) {
|
||||||
// 7ffe075a8000-7ffe075ab000 r--p 00000000 00:00 0 [vvar]
|
// 7ffe075a8000-7ffe075ab000 r--p 00000000 00:00 0 [vvar]
|
||||||
// 7ffe075ab000-7ffe075ac000 r-xp 00000000 00:00 0 [vdso]
|
// 7ffe075ab000-7ffe075ac000 r-xp 00000000 00:00 0 [vdso]
|
||||||
//
|
//
|
||||||
// /home/jart/cosmo/o/dbg/test/libc/log/backtrace_test.com.tmp.11721 1
|
// /home/jart/cosmo/o/dbg/test/libc/log/backtrace_test.tmp.11721 1
|
||||||
TEST(ShowCrashReports, testDivideByZero) {
|
TEST(ShowCrashReports, testDivideByZero) {
|
||||||
size_t got;
|
size_t got;
|
||||||
ssize_t rc;
|
ssize_t rc;
|
||||||
|
@ -187,7 +187,7 @@ TEST(ShowCrashReports, testDivideByZero) {
|
||||||
if (!pid) {
|
if (!pid) {
|
||||||
dup2(fds[1], 1);
|
dup2(fds[1], 1);
|
||||||
dup2(fds[1], 2);
|
dup2(fds[1], 2);
|
||||||
execv("bin/backtrace.com", (char *const[]){"bin/backtrace.com", "1", 0});
|
execv("bin/backtrace", (char *const[]){"bin/backtrace", "1", 0});
|
||||||
_Exit(127);
|
_Exit(127);
|
||||||
}
|
}
|
||||||
close(fds[1]);
|
close(fds[1]);
|
||||||
|
@ -312,7 +312,7 @@ TEST(ShowCrashReports, testBssOverrunCrash) {
|
||||||
if (!pid) {
|
if (!pid) {
|
||||||
dup2(fds[1], 1);
|
dup2(fds[1], 1);
|
||||||
dup2(fds[1], 2);
|
dup2(fds[1], 2);
|
||||||
execv("bin/backtrace.com", (char *const[]){"bin/backtrace.com", "2", 0});
|
execv("bin/backtrace", (char *const[]){"bin/backtrace", "2", 0});
|
||||||
_Exit(127);
|
_Exit(127);
|
||||||
}
|
}
|
||||||
close(fds[1]);
|
close(fds[1]);
|
||||||
|
@ -387,7 +387,7 @@ TEST(ShowCrashReports, testNpeCrash) {
|
||||||
if (!pid) {
|
if (!pid) {
|
||||||
dup2(fds[1], 1);
|
dup2(fds[1], 1);
|
||||||
dup2(fds[1], 2);
|
dup2(fds[1], 2);
|
||||||
execv("bin/backtrace.com", (char *const[]){"bin/backtrace.com", "7", 0});
|
execv("bin/backtrace", (char *const[]){"bin/backtrace", "7", 0});
|
||||||
_Exit(127);
|
_Exit(127);
|
||||||
}
|
}
|
||||||
close(fds[1]);
|
close(fds[1]);
|
||||||
|
@ -431,7 +431,7 @@ TEST(ShowCrashReports, testDataOverrunCrash) {
|
||||||
if (!pid) {
|
if (!pid) {
|
||||||
dup2(fds[1], 1);
|
dup2(fds[1], 1);
|
||||||
dup2(fds[1], 2);
|
dup2(fds[1], 2);
|
||||||
execv("bin/backtrace.com", (char *const[]){"bin/backtrace.com", "4", 0});
|
execv("bin/backtrace", (char *const[]){"bin/backtrace", "4", 0});
|
||||||
_Exit(127);
|
_Exit(127);
|
||||||
}
|
}
|
||||||
close(fds[1]);
|
close(fds[1]);
|
||||||
|
@ -479,7 +479,7 @@ TEST(ShowCrashReports, testNpeCrashAfterFinalize) {
|
||||||
if (!pid) {
|
if (!pid) {
|
||||||
dup2(fds[1], 1);
|
dup2(fds[1], 1);
|
||||||
dup2(fds[1], 2);
|
dup2(fds[1], 2);
|
||||||
execv("bin/backtrace.com", (char *const[]){"bin/backtrace.com", "8", 0});
|
execv("bin/backtrace", (char *const[]){"bin/backtrace", "8", 0});
|
||||||
_Exit(127);
|
_Exit(127);
|
||||||
}
|
}
|
||||||
close(fds[1]);
|
close(fds[1]);
|
||||||
|
|
|
@ -13,20 +13,20 @@ TEST_LIBC_MEM_OBJS = \
|
||||||
$(TEST_LIBC_MEM_SRCS_CC:%.cc=o/$(MODE)/%.o)
|
$(TEST_LIBC_MEM_SRCS_CC:%.cc=o/$(MODE)/%.o)
|
||||||
|
|
||||||
TEST_LIBC_MEM_COMS = \
|
TEST_LIBC_MEM_COMS = \
|
||||||
$(TEST_LIBC_MEM_SRCS_C:%.c=o/$(MODE)/%.com) \
|
$(TEST_LIBC_MEM_SRCS_C:%.c=o/$(MODE)/%) \
|
||||||
$(TEST_LIBC_MEM_SRCS_CC:%.cc=o/$(MODE)/%.com)
|
$(TEST_LIBC_MEM_SRCS_CC:%.cc=o/$(MODE)/%)
|
||||||
|
|
||||||
TEST_LIBC_MEM_BINS = \
|
TEST_LIBC_MEM_BINS = \
|
||||||
$(TEST_LIBC_MEM_COMS) \
|
$(TEST_LIBC_MEM_COMS) \
|
||||||
$(TEST_LIBC_MEM_COMS:%=%.dbg)
|
$(TEST_LIBC_MEM_COMS:%=%.dbg)
|
||||||
|
|
||||||
TEST_LIBC_MEM_TESTS = \
|
TEST_LIBC_MEM_TESTS = \
|
||||||
$(TEST_LIBC_MEM_SRCS_C:%.c=o/$(MODE)/%.com.ok) \
|
$(TEST_LIBC_MEM_SRCS_C:%.c=o/$(MODE)/%.ok) \
|
||||||
$(TEST_LIBC_MEM_SRCS_CC:%.cc=o/$(MODE)/%.com.ok)
|
$(TEST_LIBC_MEM_SRCS_CC:%.cc=o/$(MODE)/%.ok)
|
||||||
|
|
||||||
TEST_LIBC_MEM_CHECKS = \
|
TEST_LIBC_MEM_CHECKS = \
|
||||||
$(TEST_LIBC_MEM_SRCS_C:%.c=o/$(MODE)/%.com.runs) \
|
$(TEST_LIBC_MEM_SRCS_C:%.c=o/$(MODE)/%.runs) \
|
||||||
$(TEST_LIBC_MEM_SRCS_CC:%.cc=o/$(MODE)/%.com.runs)
|
$(TEST_LIBC_MEM_SRCS_CC:%.cc=o/$(MODE)/%.runs)
|
||||||
|
|
||||||
TEST_LIBC_MEM_DIRECTDEPS = \
|
TEST_LIBC_MEM_DIRECTDEPS = \
|
||||||
LIBC_CALLS \
|
LIBC_CALLS \
|
||||||
|
@ -55,7 +55,7 @@ o/$(MODE)/test/libc/mem/mem.pkg: \
|
||||||
$(TEST_LIBC_MEM_OBJS) \
|
$(TEST_LIBC_MEM_OBJS) \
|
||||||
$(foreach x,$(TEST_LIBC_MEM_DIRECTDEPS),$($(x)_A).pkg)
|
$(foreach x,$(TEST_LIBC_MEM_DIRECTDEPS),$($(x)_A).pkg)
|
||||||
|
|
||||||
o/$(MODE)/test/libc/mem/%.com.dbg: \
|
o/$(MODE)/test/libc/mem/%.dbg: \
|
||||||
$(TEST_LIBC_MEM_DEPS) \
|
$(TEST_LIBC_MEM_DEPS) \
|
||||||
o/$(MODE)/test/libc/mem/%.o \
|
o/$(MODE)/test/libc/mem/%.o \
|
||||||
o/$(MODE)/test/libc/mem/mem.pkg \
|
o/$(MODE)/test/libc/mem/mem.pkg \
|
||||||
|
@ -74,7 +74,7 @@ o/$(MODE)/test/libc/mem/prog/sock.o: \
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
o/$(MODE)/test/libc/mem/prog/life.com.dbg: \
|
o/$(MODE)/test/libc/mem/prog/life.dbg: \
|
||||||
$(LIBC_RUNTIME) \
|
$(LIBC_RUNTIME) \
|
||||||
o/$(MODE)/test/libc/mem/prog/life.o \
|
o/$(MODE)/test/libc/mem/prog/life.o \
|
||||||
$(CRT) \
|
$(CRT) \
|
||||||
|
@ -82,14 +82,14 @@ o/$(MODE)/test/libc/mem/prog/life.com.dbg: \
|
||||||
@$(APELINK)
|
@$(APELINK)
|
||||||
|
|
||||||
o/$(MODE)/test/libc/mem/prog/life.elf: \
|
o/$(MODE)/test/libc/mem/prog/life.elf: \
|
||||||
o/$(MODE)/tool/build/assimilate.com \
|
o/$(MODE)/tool/build/assimilate \
|
||||||
o/$(MODE)/test/libc/mem/prog/life.com
|
o/$(MODE)/test/libc/mem/prog/life
|
||||||
@$(COMPILE) -wACP -T$@ \
|
@$(COMPILE) -wACP -T$@ \
|
||||||
build/bootstrap/cp.com \
|
build/bootstrap/cp \
|
||||||
o/$(MODE)/test/libc/mem/prog/life.com \
|
o/$(MODE)/test/libc/mem/prog/life \
|
||||||
o/$(MODE)/test/libc/mem/prog/life.elf
|
o/$(MODE)/test/libc/mem/prog/life.elf
|
||||||
@$(COMPILE) -wAASSIMILATE -T$@ \
|
@$(COMPILE) -wAASSIMILATE -T$@ \
|
||||||
o/$(MODE)/tool/build/assimilate.com -bcef \
|
o/$(MODE)/tool/build/assimilate -bcef \
|
||||||
o/$(MODE)/test/libc/mem/prog/life.elf
|
o/$(MODE)/test/libc/mem/prog/life.elf
|
||||||
|
|
||||||
o/$(MODE)/test/libc/mem/prog/life.elf.zip.o: private \
|
o/$(MODE)/test/libc/mem/prog/life.elf.zip.o: private \
|
||||||
|
@ -98,13 +98,13 @@ o/$(MODE)/test/libc/mem/prog/life.elf.zip.o: private \
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
o/$(MODE)/test/libc/mem/prog/life.com.zip.o: private \
|
o/$(MODE)/test/libc/mem/prog/life.zip.o: private \
|
||||||
ZIPOBJ_FLAGS += \
|
ZIPOBJ_FLAGS += \
|
||||||
-B
|
-B
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
o/$(MODE)/test/libc/mem/prog/sock.com.dbg: \
|
o/$(MODE)/test/libc/mem/prog/sock.dbg: \
|
||||||
$(LIBC_RUNTIME) \
|
$(LIBC_RUNTIME) \
|
||||||
$(LIBC_SOCK) \
|
$(LIBC_SOCK) \
|
||||||
o/$(MODE)/test/libc/mem/prog/sock.o \
|
o/$(MODE)/test/libc/mem/prog/sock.o \
|
||||||
|
@ -113,14 +113,14 @@ o/$(MODE)/test/libc/mem/prog/sock.com.dbg: \
|
||||||
@$(APELINK)
|
@$(APELINK)
|
||||||
|
|
||||||
o/$(MODE)/test/libc/mem/prog/sock.elf: \
|
o/$(MODE)/test/libc/mem/prog/sock.elf: \
|
||||||
o/$(MODE)/tool/build/assimilate.com \
|
o/$(MODE)/tool/build/assimilate \
|
||||||
o/$(MODE)/test/libc/mem/prog/sock.com
|
o/$(MODE)/test/libc/mem/prog/sock
|
||||||
@$(COMPILE) -wACP -T$@ \
|
@$(COMPILE) -wACP -T$@ \
|
||||||
build/bootstrap/cp.com \
|
build/bootstrap/cp \
|
||||||
o/$(MODE)/test/libc/mem/prog/sock.com \
|
o/$(MODE)/test/libc/mem/prog/sock \
|
||||||
o/$(MODE)/test/libc/mem/prog/sock.elf
|
o/$(MODE)/test/libc/mem/prog/sock.elf
|
||||||
@$(COMPILE) -wAASSIMILATE -T$@ \
|
@$(COMPILE) -wAASSIMILATE -T$@ \
|
||||||
o/$(MODE)/tool/build/assimilate.com -cef \
|
o/$(MODE)/tool/build/assimilate -cef \
|
||||||
o/$(MODE)/test/libc/mem/prog/sock.elf
|
o/$(MODE)/test/libc/mem/prog/sock.elf
|
||||||
|
|
||||||
o/$(MODE)/test/libc/mem/prog/sock.elf.zip.o: private \
|
o/$(MODE)/test/libc/mem/prog/sock.elf.zip.o: private \
|
||||||
|
|
|
@ -12,17 +12,17 @@ TEST_LIBC_NEXGEN32E_OBJS = \
|
||||||
$(TEST_LIBC_NEXGEN32E_SRCS:%.c=o/$(MODE)/%.o)
|
$(TEST_LIBC_NEXGEN32E_SRCS:%.c=o/$(MODE)/%.o)
|
||||||
|
|
||||||
TEST_LIBC_NEXGEN32E_COMS = \
|
TEST_LIBC_NEXGEN32E_COMS = \
|
||||||
$(TEST_LIBC_NEXGEN32E_SRCS:%.c=o/$(MODE)/%.com)
|
$(TEST_LIBC_NEXGEN32E_SRCS:%.c=o/$(MODE)/%)
|
||||||
|
|
||||||
TEST_LIBC_NEXGEN32E_BINS = \
|
TEST_LIBC_NEXGEN32E_BINS = \
|
||||||
$(TEST_LIBC_NEXGEN32E_COMS) \
|
$(TEST_LIBC_NEXGEN32E_COMS) \
|
||||||
$(TEST_LIBC_NEXGEN32E_COMS:%=%.dbg)
|
$(TEST_LIBC_NEXGEN32E_COMS:%=%.dbg)
|
||||||
|
|
||||||
TEST_LIBC_NEXGEN32E_TESTS = \
|
TEST_LIBC_NEXGEN32E_TESTS = \
|
||||||
$(TEST_LIBC_NEXGEN32E_SRCS_TEST:%.c=o/$(MODE)/%.com.ok)
|
$(TEST_LIBC_NEXGEN32E_SRCS_TEST:%.c=o/$(MODE)/%.ok)
|
||||||
|
|
||||||
TEST_LIBC_NEXGEN32E_CHECKS = \
|
TEST_LIBC_NEXGEN32E_CHECKS = \
|
||||||
$(TEST_LIBC_NEXGEN32E_SRCS_TEST:%.c=o/$(MODE)/%.com.runs)
|
$(TEST_LIBC_NEXGEN32E_SRCS_TEST:%.c=o/$(MODE)/%.runs)
|
||||||
|
|
||||||
TEST_LIBC_NEXGEN32E_DIRECTDEPS = \
|
TEST_LIBC_NEXGEN32E_DIRECTDEPS = \
|
||||||
LIBC_CALLS \
|
LIBC_CALLS \
|
||||||
|
@ -48,7 +48,7 @@ o/$(MODE)/test/libc/nexgen32e/nexgen32e.pkg: \
|
||||||
$(TEST_LIBC_NEXGEN32E_OBJS) \
|
$(TEST_LIBC_NEXGEN32E_OBJS) \
|
||||||
$(foreach x,$(TEST_LIBC_NEXGEN32E_DIRECTDEPS),$($(x)_A).pkg)
|
$(foreach x,$(TEST_LIBC_NEXGEN32E_DIRECTDEPS),$($(x)_A).pkg)
|
||||||
|
|
||||||
o/$(MODE)/test/libc/nexgen32e/%.com.dbg: \
|
o/$(MODE)/test/libc/nexgen32e/%.dbg: \
|
||||||
$(TEST_LIBC_NEXGEN32E_DEPS) \
|
$(TEST_LIBC_NEXGEN32E_DEPS) \
|
||||||
o/$(MODE)/test/libc/nexgen32e/%.o \
|
o/$(MODE)/test/libc/nexgen32e/%.o \
|
||||||
o/$(MODE)/test/libc/nexgen32e/nexgen32e.pkg \
|
o/$(MODE)/test/libc/nexgen32e/nexgen32e.pkg \
|
||||||
|
@ -58,10 +58,10 @@ o/$(MODE)/test/libc/nexgen32e/%.com.dbg: \
|
||||||
@$(APELINK)
|
@$(APELINK)
|
||||||
|
|
||||||
# we can't run this test on openbsd because rwx memory isn't allowed
|
# we can't run this test on openbsd because rwx memory isn't allowed
|
||||||
o/$(MODE)/test/libc/nexgen32e/stackrwx_test.com.ok: \
|
o/$(MODE)/test/libc/nexgen32e/stackrwx_test.ok: \
|
||||||
o/$(MODE)/tool/build/runit.com \
|
o/$(MODE)/tool/build/runit \
|
||||||
o/$(MODE)/tool/build/runitd.com \
|
o/$(MODE)/tool/build/runitd \
|
||||||
o/$(MODE)/test/libc/nexgen32e/stackrwx_test.com
|
o/$(MODE)/test/libc/nexgen32e/stackrwx_test
|
||||||
@$(COMPILE) -wATEST -tT$@ $^ $(filter-out openbsd,$(HOSTS))
|
@$(COMPILE) -wATEST -tT$@ $^ $(filter-out openbsd,$(HOSTS))
|
||||||
|
|
||||||
$(TEST_LIBC_NEXGEN32E_OBJS): private \
|
$(TEST_LIBC_NEXGEN32E_OBJS): private \
|
||||||
|
|
|
@ -6,90 +6,90 @@ PKGS += TEST_LIBC_PROC
|
||||||
TEST_LIBC_PROC_SRCS := $(wildcard test/libc/proc/*.c)
|
TEST_LIBC_PROC_SRCS := $(wildcard test/libc/proc/*.c)
|
||||||
TEST_LIBC_PROC_SRCS_TEST = $(filter %_test.c,$(TEST_LIBC_PROC_SRCS))
|
TEST_LIBC_PROC_SRCS_TEST = $(filter %_test.c,$(TEST_LIBC_PROC_SRCS))
|
||||||
|
|
||||||
TEST_LIBC_PROC_OBJS = \
|
TEST_LIBC_PROC_OBJS = \
|
||||||
$(TEST_LIBC_PROC_SRCS:%.c=o/$(MODE)/%.o)
|
$(TEST_LIBC_PROC_SRCS:%.c=o/$(MODE)/%.o)
|
||||||
|
|
||||||
TEST_LIBC_PROC_COMS = \
|
TEST_LIBC_PROC_COMS = \
|
||||||
$(TEST_LIBC_PROC_SRCS:%.c=o/$(MODE)/%.com)
|
$(TEST_LIBC_PROC_SRCS:%.c=o/$(MODE)/%)
|
||||||
|
|
||||||
TEST_LIBC_PROC_BINS = \
|
TEST_LIBC_PROC_BINS = \
|
||||||
$(TEST_LIBC_PROC_COMS) \
|
$(TEST_LIBC_PROC_COMS) \
|
||||||
$(TEST_LIBC_PROC_COMS:%=%.dbg)
|
$(TEST_LIBC_PROC_COMS:%=%.dbg)
|
||||||
|
|
||||||
TEST_LIBC_PROC_TESTS = \
|
TEST_LIBC_PROC_TESTS = \
|
||||||
$(TEST_LIBC_PROC_SRCS_TEST:%.c=o/$(MODE)/%.com.ok)
|
$(TEST_LIBC_PROC_SRCS_TEST:%.c=o/$(MODE)/%.ok)
|
||||||
|
|
||||||
TEST_LIBC_PROC_CHECKS = \
|
TEST_LIBC_PROC_CHECKS = \
|
||||||
$(TEST_LIBC_PROC_SRCS_TEST:%.c=o/$(MODE)/%.com.runs)
|
$(TEST_LIBC_PROC_SRCS_TEST:%.c=o/$(MODE)/%.runs)
|
||||||
|
|
||||||
TEST_LIBC_PROC_DIRECTDEPS = \
|
TEST_LIBC_PROC_DIRECTDEPS = \
|
||||||
LIBC_CALLS \
|
LIBC_CALLS \
|
||||||
LIBC_FMT \
|
LIBC_FMT \
|
||||||
LIBC_INTRIN \
|
LIBC_INTRIN \
|
||||||
LIBC_MEM \
|
LIBC_MEM \
|
||||||
LIBC_NEXGEN32E \
|
LIBC_NEXGEN32E \
|
||||||
LIBC_NT_KERNEL32 \
|
LIBC_NT_KERNEL32 \
|
||||||
LIBC_RUNTIME \
|
LIBC_RUNTIME \
|
||||||
LIBC_PROC \
|
LIBC_PROC \
|
||||||
LIBC_STR \
|
LIBC_STR \
|
||||||
LIBC_SYSV \
|
LIBC_SYSV \
|
||||||
LIBC_TESTLIB \
|
LIBC_TESTLIB \
|
||||||
LIBC_THREAD \
|
LIBC_THREAD \
|
||||||
LIBC_X \
|
LIBC_X \
|
||||||
THIRD_PARTY_MUSL \
|
THIRD_PARTY_MUSL \
|
||||||
THIRD_PARTY_TR
|
THIRD_PARTY_TR
|
||||||
|
|
||||||
TEST_LIBC_PROC_DEPS := \
|
TEST_LIBC_PROC_DEPS := \
|
||||||
$(call uniq,$(foreach x,$(TEST_LIBC_PROC_DIRECTDEPS),$($(x))))
|
$(call uniq,$(foreach x,$(TEST_LIBC_PROC_DIRECTDEPS),$($(x))))
|
||||||
|
|
||||||
o/$(MODE)/test/libc/proc/proc.pkg: \
|
o/$(MODE)/test/libc/proc/proc.pkg: \
|
||||||
$(TEST_LIBC_PROC_OBJS) \
|
$(TEST_LIBC_PROC_OBJS) \
|
||||||
$(foreach x,$(TEST_LIBC_PROC_DIRECTDEPS),$($(x)_A).pkg)
|
$(foreach x,$(TEST_LIBC_PROC_DIRECTDEPS),$($(x)_A).pkg)
|
||||||
|
|
||||||
o/$(MODE)/test/libc/proc/%.com.dbg: \
|
o/$(MODE)/test/libc/proc/%.dbg: \
|
||||||
$(TEST_LIBC_PROC_DEPS) \
|
$(TEST_LIBC_PROC_DEPS) \
|
||||||
o/$(MODE)/test/libc/proc/%.o \
|
o/$(MODE)/test/libc/proc/%.o \
|
||||||
o/$(MODE)/test/libc/proc/proc.pkg \
|
o/$(MODE)/test/libc/proc/proc.pkg \
|
||||||
o/$(MODE)/tool/build/echo.com.zip.o \
|
o/$(MODE)/tool/build/echo.zip.o \
|
||||||
$(LIBC_TESTMAIN) \
|
$(LIBC_TESTMAIN) \
|
||||||
$(CRT) \
|
$(CRT) \
|
||||||
$(APE_NO_MODIFY_SELF)
|
$(APE_NO_MODIFY_SELF)
|
||||||
@$(APELINK)
|
@$(APELINK)
|
||||||
|
|
||||||
o/$(MODE)/test/libc/proc/posix_spawn_test.com.runs: \
|
o/$(MODE)/test/libc/proc/posix_spawn_test.runs: \
|
||||||
private QUOTA += -M8192m
|
private QUOTA += -M8192m
|
||||||
|
|
||||||
o/$(MODE)/test/libc/proc/posix_spawn_test.com.dbg: \
|
o/$(MODE)/test/libc/proc/posix_spawn_test.dbg: \
|
||||||
$(TEST_LIBC_PROC_DEPS) \
|
$(TEST_LIBC_PROC_DEPS) \
|
||||||
o/$(MODE)/test/libc/proc/posix_spawn_test.o \
|
o/$(MODE)/test/libc/proc/posix_spawn_test.o \
|
||||||
o/$(MODE)/test/libc/proc/proc.pkg \
|
o/$(MODE)/test/libc/proc/proc.pkg \
|
||||||
o/$(MODE)/tool/build/echo.com.zip.o \
|
o/$(MODE)/tool/build/echo.zip.o \
|
||||||
o/$(MODE)/tool/build/cocmd.com.zip.o \
|
o/$(MODE)/tool/build/cocmd.zip.o \
|
||||||
o/$(MODE)/test/libc/mem/prog/life.com.zip.o \
|
o/$(MODE)/test/libc/mem/prog/life.zip.o \
|
||||||
o/$(MODE)/test/libc/mem/prog/life.elf.zip.o \
|
o/$(MODE)/test/libc/mem/prog/life.elf.zip.o \
|
||||||
o/$(MODE)/test/libc/proc/life-pe.com.zip.o \
|
o/$(MODE)/test/libc/proc/life-pe.zip.o \
|
||||||
$(LIBC_TESTMAIN) \
|
$(LIBC_TESTMAIN) \
|
||||||
$(CRT) \
|
$(CRT) \
|
||||||
$(APE_NO_MODIFY_SELF)
|
$(APE_NO_MODIFY_SELF)
|
||||||
@$(APELINK)
|
@$(APELINK)
|
||||||
|
|
||||||
o/$(MODE)/test/libc/proc/system_test.com.dbg: \
|
o/$(MODE)/test/libc/proc/system_test.dbg: \
|
||||||
$(TEST_LIBC_PROC_DEPS) \
|
$(TEST_LIBC_PROC_DEPS) \
|
||||||
o/$(MODE)/test/libc/proc/system_test.o \
|
o/$(MODE)/test/libc/proc/system_test.o \
|
||||||
o/$(MODE)/test/libc/proc/proc.pkg \
|
o/$(MODE)/test/libc/proc/proc.pkg \
|
||||||
o/$(MODE)/tool/build/echo.com.zip.o \
|
o/$(MODE)/tool/build/echo.zip.o \
|
||||||
o/$(MODE)/tool/build/cocmd.com.zip.o \
|
o/$(MODE)/tool/build/cocmd.zip.o \
|
||||||
o/$(MODE)/tool/build/false.com.zip.o \
|
o/$(MODE)/tool/build/false.zip.o \
|
||||||
$(LIBC_TESTMAIN) \
|
$(LIBC_TESTMAIN) \
|
||||||
$(CRT) \
|
$(CRT) \
|
||||||
$(APE_NO_MODIFY_SELF)
|
$(APE_NO_MODIFY_SELF)
|
||||||
@$(APELINK)
|
@$(APELINK)
|
||||||
|
|
||||||
o/$(MODE)/test/libc/proc/execve_test.com.dbg: \
|
o/$(MODE)/test/libc/proc/execve_test.dbg: \
|
||||||
$(TEST_LIBC_PROC_DEPS) \
|
$(TEST_LIBC_PROC_DEPS) \
|
||||||
o/$(MODE)/test/libc/proc/execve_test.o \
|
o/$(MODE)/test/libc/proc/execve_test.o \
|
||||||
o/$(MODE)/test/libc/calls/life-nomod.com.zip.o \
|
o/$(MODE)/test/libc/calls/life-nomod.zip.o \
|
||||||
o/$(MODE)/test/libc/proc/execve_test_prog1.com.zip.o \
|
o/$(MODE)/test/libc/proc/execve_test_prog1.zip.o \
|
||||||
o/$(MODE)/test/libc/mem/prog/life.elf.zip.o \
|
o/$(MODE)/test/libc/mem/prog/life.elf.zip.o \
|
||||||
o/$(MODE)/test/libc/mem/prog/sock.elf.zip.o \
|
o/$(MODE)/test/libc/mem/prog/sock.elf.zip.o \
|
||||||
o/$(MODE)/test/libc/proc/proc.pkg \
|
o/$(MODE)/test/libc/proc/proc.pkg \
|
||||||
|
@ -98,26 +98,26 @@ o/$(MODE)/test/libc/proc/execve_test.com.dbg: \
|
||||||
$(APE_NO_MODIFY_SELF)
|
$(APE_NO_MODIFY_SELF)
|
||||||
@$(APELINK)
|
@$(APELINK)
|
||||||
|
|
||||||
o/$(MODE)/test/libc/proc/fexecve_test.com.dbg: \
|
o/$(MODE)/test/libc/proc/fexecve_test.dbg: \
|
||||||
$(TEST_LIBC_PROC_DEPS) \
|
$(TEST_LIBC_PROC_DEPS) \
|
||||||
o/$(MODE)/test/libc/proc/fexecve_test.o \
|
o/$(MODE)/test/libc/proc/fexecve_test.o \
|
||||||
o/$(MODE)/test/libc/proc/proc.pkg \
|
o/$(MODE)/test/libc/proc/proc.pkg \
|
||||||
o/$(MODE)/test/libc/mem/prog/life.elf.zip.o \
|
o/$(MODE)/test/libc/mem/prog/life.elf.zip.o \
|
||||||
o/$(MODE)/test/libc/calls/life-nomod.com.zip.o \
|
o/$(MODE)/test/libc/calls/life-nomod.zip.o \
|
||||||
o/$(MODE)/test/libc/calls/zipread.com.zip.o \
|
o/$(MODE)/test/libc/calls/zipread.zip.o \
|
||||||
$(LIBC_TESTMAIN) \
|
$(LIBC_TESTMAIN) \
|
||||||
$(CRT) \
|
$(CRT) \
|
||||||
$(APE_NO_MODIFY_SELF)
|
$(APE_NO_MODIFY_SELF)
|
||||||
@$(APELINK)
|
@$(APELINK)
|
||||||
|
|
||||||
o/$(MODE)/test/libc/proc/execve_test_prog1.com.zip.o \
|
o/$(MODE)/test/libc/proc/execve_test_prog1.zip.o \
|
||||||
o/$(MODE)/test/libc/proc/life-pe.com.zip.o: private \
|
o/$(MODE)/test/libc/proc/life-pe.zip.o: private \
|
||||||
ZIPOBJ_FLAGS += \
|
ZIPOBJ_FLAGS += \
|
||||||
-B
|
-B
|
||||||
|
|
||||||
$(TEST_LIBC_PROC_OBJS): test/libc/proc/BUILD.mk
|
$(TEST_LIBC_PROC_OBJS): test/libc/proc/BUILD.mk
|
||||||
|
|
||||||
.PHONY: o/$(MODE)/test/libc/proc
|
.PHONY: o/$(MODE)/test/libc/proc
|
||||||
o/$(MODE)/test/libc/proc: \
|
o/$(MODE)/test/libc/proc: \
|
||||||
$(TEST_LIBC_PROC_BINS) \
|
$(TEST_LIBC_PROC_BINS) \
|
||||||
$(TEST_LIBC_PROC_CHECKS)
|
$(TEST_LIBC_PROC_CHECKS)
|
||||||
|
|
|
@ -51,8 +51,8 @@ void GenBuf(char buf[8], int x) {
|
||||||
TEST(execve, testArgPassing) {
|
TEST(execve, testArgPassing) {
|
||||||
int i;
|
int i;
|
||||||
char ibuf[12], buf[8];
|
char ibuf[12], buf[8];
|
||||||
const char *prog = "./execve_test_prog1.com";
|
const char *prog = "./execve_test_prog1";
|
||||||
testlib_extract("/zip/execve_test_prog1.com", prog, 0755);
|
testlib_extract("/zip/execve_test_prog1", prog, 0755);
|
||||||
for (i = 0; i < N; ++i) {
|
for (i = 0; i < N; ++i) {
|
||||||
FormatInt32(ibuf, i);
|
FormatInt32(ibuf, i);
|
||||||
GenBuf(buf, i);
|
GenBuf(buf, i);
|
||||||
|
@ -84,12 +84,12 @@ TEST(execve, ziposAPE) {
|
||||||
if (IsFreebsd()) return; // TODO: fixme on freebsd
|
if (IsFreebsd()) return; // TODO: fixme on freebsd
|
||||||
if (IsLinux() && !__is_linux_2_6_23()) return; // TODO: fixme on old linux
|
if (IsLinux() && !__is_linux_2_6_23()) return; // TODO: fixme on old linux
|
||||||
if (!IsLinux() && !IsFreebsd()) {
|
if (!IsLinux() && !IsFreebsd()) {
|
||||||
EXPECT_EQ(-1, execve("/zip/life-nomod.com", (char *const[]){0},
|
EXPECT_EQ(
|
||||||
(char *const[]){0}));
|
-1, execve("/zip/life-nomod", (char *const[]){0}, (char *const[]){0}));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
SPAWN(fork);
|
SPAWN(fork);
|
||||||
execve("/zip/life-nomod.com", (char *const[]){0}, (char *const[]){0});
|
execve("/zip/life-nomod", (char *const[]){0}, (char *const[]){0});
|
||||||
kprintf("execve failed: %m\n");
|
kprintf("execve failed: %m\n");
|
||||||
EXITS(42);
|
EXITS(42);
|
||||||
}
|
}
|
||||||
|
|
|
@ -102,9 +102,9 @@ TEST(fexecve, memfd_create) {
|
||||||
|
|
||||||
TEST(fexecve, APE) {
|
TEST(fexecve, APE) {
|
||||||
if (!IsLinux() && !IsFreebsd()) return;
|
if (!IsLinux() && !IsFreebsd()) return;
|
||||||
testlib_extract("/zip/life-nomod.com", "life-nomod.com", 0555);
|
testlib_extract("/zip/life-nomod", "life-nomod", 0555);
|
||||||
SPAWN(fork);
|
SPAWN(fork);
|
||||||
int fd = open("life-nomod.com", O_RDONLY);
|
int fd = open("life-nomod", O_RDONLY);
|
||||||
ASSERT_NE(-1, fd);
|
ASSERT_NE(-1, fd);
|
||||||
fexecve(fd, (char *const[]){0}, (char *const[]){0});
|
fexecve(fd, (char *const[]){0}, (char *const[]){0});
|
||||||
EXITS(42);
|
EXITS(42);
|
||||||
|
@ -112,9 +112,9 @@ TEST(fexecve, APE) {
|
||||||
|
|
||||||
TEST(fexecve, APE_cloexec) {
|
TEST(fexecve, APE_cloexec) {
|
||||||
if (!IsLinux() && !IsFreebsd()) return;
|
if (!IsLinux() && !IsFreebsd()) return;
|
||||||
testlib_extract("/zip/life-nomod.com", "life-nomod.com", 0555);
|
testlib_extract("/zip/life-nomod", "life-nomod", 0555);
|
||||||
SPAWN(fork);
|
SPAWN(fork);
|
||||||
int fd = open("life-nomod.com", O_RDONLY | O_CLOEXEC);
|
int fd = open("life-nomod", O_RDONLY | O_CLOEXEC);
|
||||||
ASSERT_NE(-1, fd);
|
ASSERT_NE(-1, fd);
|
||||||
fexecve(fd, (char *const[]){0}, (char *const[]){0});
|
fexecve(fd, (char *const[]){0}, (char *const[]){0});
|
||||||
EXITS(42);
|
EXITS(42);
|
||||||
|
@ -132,7 +132,7 @@ TEST(fexecve, zipos) {
|
||||||
|
|
||||||
TEST(fexecve, ziposAPE) {
|
TEST(fexecve, ziposAPE) {
|
||||||
if (!IsLinux() && !IsFreebsd()) return;
|
if (!IsLinux() && !IsFreebsd()) return;
|
||||||
int fd = open("/zip/life-nomod.com", O_RDONLY);
|
int fd = open("/zip/life-nomod", O_RDONLY);
|
||||||
ASSERT_NE(-1, fd);
|
ASSERT_NE(-1, fd);
|
||||||
SPAWN(fork);
|
SPAWN(fork);
|
||||||
fexecve(fd, (char *const[]){0}, (char *const[]){0});
|
fexecve(fd, (char *const[]){0}, (char *const[]){0});
|
||||||
|
@ -143,7 +143,7 @@ TEST(fexecve, ziposAPE) {
|
||||||
TEST(fexecve, ziposAPEHasZipos) {
|
TEST(fexecve, ziposAPEHasZipos) {
|
||||||
if (1) return; // TODO: fixme
|
if (1) return; // TODO: fixme
|
||||||
if (!IsLinux() && !IsFreebsd()) return;
|
if (!IsLinux() && !IsFreebsd()) return;
|
||||||
int fd = open("/zip/zipread.com", O_RDONLY);
|
int fd = open("/zip/zipread", O_RDONLY);
|
||||||
ASSERT_NE(-1, fd);
|
ASSERT_NE(-1, fd);
|
||||||
SPAWN(fork);
|
SPAWN(fork);
|
||||||
ASSERT_NE(-1, fd);
|
ASSERT_NE(-1, fd);
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
|
|
||||||
void SetUp(void) {
|
void SetUp(void) {
|
||||||
if (getpriority(PRIO_PROCESS, getpid()) != 0) {
|
if (getpriority(PRIO_PROCESS, getpid()) != 0) {
|
||||||
kprintf("getpriority_test.com must be launched at priority zero\n");
|
kprintf("getpriority_test must be launched at priority zero\n");
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -118,10 +118,10 @@ TEST(posix_spawn, self) {
|
||||||
|
|
||||||
TEST(posix_spawn, ape) {
|
TEST(posix_spawn, ape) {
|
||||||
int ws, pid;
|
int ws, pid;
|
||||||
char *prog = "./life.com";
|
char *prog = "./life";
|
||||||
char *args[] = {prog, 0};
|
char *args[] = {prog, 0};
|
||||||
char *envs[] = {0};
|
char *envs[] = {0};
|
||||||
testlib_extract("/zip/life.com", prog, 0755);
|
testlib_extract("/zip/life", prog, 0755);
|
||||||
ASSERT_EQ(0, posix_spawn(&pid, prog, NULL, NULL, args, envs));
|
ASSERT_EQ(0, posix_spawn(&pid, prog, NULL, NULL, args, envs));
|
||||||
ASSERT_NE(-1, waitpid(pid, &ws, 0));
|
ASSERT_NE(-1, waitpid(pid, &ws, 0));
|
||||||
ASSERT_TRUE(WIFEXITED(ws));
|
ASSERT_TRUE(WIFEXITED(ws));
|
||||||
|
@ -145,9 +145,9 @@ TEST(posix_spawn, elf) {
|
||||||
TEST(posix_spawn, pipe) {
|
TEST(posix_spawn, pipe) {
|
||||||
char buf[10];
|
char buf[10];
|
||||||
int p[2], pid, status;
|
int p[2], pid, status;
|
||||||
const char *pn = "./echo.com";
|
const char *pn = "./echo";
|
||||||
posix_spawn_file_actions_t fa;
|
posix_spawn_file_actions_t fa;
|
||||||
testlib_extract("/zip/echo.com", "echo.com", 0755);
|
testlib_extract("/zip/echo", "echo", 0755);
|
||||||
ASSERT_SYS(0, 0, pipe(p));
|
ASSERT_SYS(0, 0, pipe(p));
|
||||||
ASSERT_EQ(0, posix_spawn_file_actions_init(&fa));
|
ASSERT_EQ(0, posix_spawn_file_actions_init(&fa));
|
||||||
ASSERT_EQ(0, posix_spawn_file_actions_addclose(&fa, p[0]));
|
ASSERT_EQ(0, posix_spawn_file_actions_addclose(&fa, p[0]));
|
||||||
|
@ -165,17 +165,17 @@ TEST(posix_spawn, pipe) {
|
||||||
TEST(posix_spawn, chdir) {
|
TEST(posix_spawn, chdir) {
|
||||||
int ws, pid, p[2];
|
int ws, pid, p[2];
|
||||||
char buf[16] = {0};
|
char buf[16] = {0};
|
||||||
char *args[] = {"cocmd.com", "-c", "cat hello.txt", 0};
|
char *args[] = {"cocmd", "-c", "cat hello.txt", 0};
|
||||||
char *envs[] = {0};
|
char *envs[] = {0};
|
||||||
posix_spawn_file_actions_t fa;
|
posix_spawn_file_actions_t fa;
|
||||||
testlib_extract("/zip/cocmd.com", "cocmd.com", 0755);
|
testlib_extract("/zip/cocmd", "cocmd", 0755);
|
||||||
ASSERT_SYS(0, 0, mkdir("subdir", 0777));
|
ASSERT_SYS(0, 0, mkdir("subdir", 0777));
|
||||||
ASSERT_SYS(0, 0, xbarf("subdir/hello.txt", "hello\n", -1));
|
ASSERT_SYS(0, 0, xbarf("subdir/hello.txt", "hello\n", -1));
|
||||||
ASSERT_SYS(0, 0, pipe2(p, O_CLOEXEC));
|
ASSERT_SYS(0, 0, pipe2(p, O_CLOEXEC));
|
||||||
ASSERT_EQ(0, posix_spawn_file_actions_init(&fa));
|
ASSERT_EQ(0, posix_spawn_file_actions_init(&fa));
|
||||||
ASSERT_EQ(0, posix_spawn_file_actions_adddup2(&fa, p[1], 1));
|
ASSERT_EQ(0, posix_spawn_file_actions_adddup2(&fa, p[1], 1));
|
||||||
ASSERT_EQ(0, posix_spawn_file_actions_addchdir_np(&fa, "subdir"));
|
ASSERT_EQ(0, posix_spawn_file_actions_addchdir_np(&fa, "subdir"));
|
||||||
ASSERT_EQ(0, posix_spawn(&pid, "../cocmd.com", &fa, 0, args, envs));
|
ASSERT_EQ(0, posix_spawn(&pid, "../cocmd", &fa, 0, args, envs));
|
||||||
ASSERT_EQ(0, posix_spawn_file_actions_destroy(&fa));
|
ASSERT_EQ(0, posix_spawn_file_actions_destroy(&fa));
|
||||||
ASSERT_SYS(0, 0, close(p[1]));
|
ASSERT_SYS(0, 0, close(p[1]));
|
||||||
ASSERT_NE(-1, waitpid(pid, &ws, 0));
|
ASSERT_NE(-1, waitpid(pid, &ws, 0));
|
||||||
|
@ -201,8 +201,8 @@ TEST(posix_spawn, torture) {
|
||||||
posix_spawn_file_actions_t fa;
|
posix_spawn_file_actions_t fa;
|
||||||
signal(SIGUSR2, OhMyGoth);
|
signal(SIGUSR2, OhMyGoth);
|
||||||
sigfillset(&allsig);
|
sigfillset(&allsig);
|
||||||
if (!fileexists("echo.com")) {
|
if (!fileexists("echo")) {
|
||||||
testlib_extract("/zip/echo.com", "echo.com", 0755);
|
testlib_extract("/zip/echo", "echo", 0755);
|
||||||
}
|
}
|
||||||
// XXX: NetBSD doesn't seem to let us set the scheduler to itself ;_;
|
// XXX: NetBSD doesn't seem to let us set the scheduler to itself ;_;
|
||||||
ASSERT_EQ(0, posix_spawnattr_init(&attr));
|
ASSERT_EQ(0, posix_spawnattr_init(&attr));
|
||||||
|
@ -220,10 +220,10 @@ TEST(posix_spawn, torture) {
|
||||||
for (int i = 0; i < n; ++i) {
|
for (int i = 0; i < n; ++i) {
|
||||||
char *volatile zzz = malloc(13);
|
char *volatile zzz = malloc(13);
|
||||||
volatile int fd = open("/dev/null", O_WRONLY);
|
volatile int fd = open("/dev/null", O_WRONLY);
|
||||||
char *args[] = {"./echo.com", NULL};
|
char *args[] = {"./echo", NULL};
|
||||||
char *envs[] = {NULL};
|
char *envs[] = {NULL};
|
||||||
raise(SIGUSR2);
|
raise(SIGUSR2);
|
||||||
ASSERT_EQ(0, posix_spawn(&pid, "./echo.com", &fa, &attr, args, envs));
|
ASSERT_EQ(0, posix_spawn(&pid, "./echo", &fa, &attr, args, envs));
|
||||||
ASSERT_FALSE(__vforked);
|
ASSERT_FALSE(__vforked);
|
||||||
ASSERT_NE(-1, waitpid(pid, &ws, 0));
|
ASSERT_NE(-1, waitpid(pid, &ws, 0));
|
||||||
EXPECT_FALSE(WIFSIGNALED(ws));
|
EXPECT_FALSE(WIFSIGNALED(ws));
|
||||||
|
@ -246,7 +246,7 @@ void *Torturer(void *arg) {
|
||||||
TEST(posix_spawn, agony) {
|
TEST(posix_spawn, agony) {
|
||||||
int i, n = 4;
|
int i, n = 4;
|
||||||
pthread_t *t = gc(malloc(sizeof(pthread_t) * n));
|
pthread_t *t = gc(malloc(sizeof(pthread_t) * n));
|
||||||
testlib_extract("/zip/echo.com", "echo.com", 0755);
|
testlib_extract("/zip/echo", "echo", 0755);
|
||||||
for (i = 0; i < n; ++i) {
|
for (i = 0; i < n; ++i) {
|
||||||
ASSERT_EQ(0, pthread_create(t + i, 0, Torturer, 0));
|
ASSERT_EQ(0, pthread_create(t + i, 0, Torturer, 0));
|
||||||
}
|
}
|
||||||
|
@ -264,11 +264,11 @@ TEST(posix_spawn, etxtbsy) {
|
||||||
if (IsNetbsd()) return; // they don't appear impacted by this race condition
|
if (IsNetbsd()) return; // they don't appear impacted by this race condition
|
||||||
if (IsOpenbsd()) return; // they don't appear impacted by this race condition
|
if (IsOpenbsd()) return; // they don't appear impacted by this race condition
|
||||||
int ws, me, pid, thief;
|
int ws, me, pid, thief;
|
||||||
char *prog = "./life.com";
|
char *prog = "./life";
|
||||||
char *args[] = {prog, 0};
|
char *args[] = {prog, 0};
|
||||||
char *envs[] = {0};
|
char *envs[] = {0};
|
||||||
sigset_t ss, old;
|
sigset_t ss, old;
|
||||||
testlib_extract("/zip/life.com", prog, 0755);
|
testlib_extract("/zip/life", prog, 0755);
|
||||||
for (int i = 0; i < 2; ++i) {
|
for (int i = 0; i < 2; ++i) {
|
||||||
sigemptyset(&ss);
|
sigemptyset(&ss);
|
||||||
sigaddset(&ss, SIGUSR1);
|
sigaddset(&ss, SIGUSR1);
|
||||||
|
@ -382,22 +382,21 @@ BENCH(posix_spawn, bench) {
|
||||||
creat("tiny64", 0755);
|
creat("tiny64", 0755);
|
||||||
write(3, kTinyLinuxExit, 128);
|
write(3, kTinyLinuxExit, 128);
|
||||||
close(3);
|
close(3);
|
||||||
testlib_extract("/zip/life.com", "life.com", 0755);
|
testlib_extract("/zip/life", "life", 0755);
|
||||||
testlib_extract("/zip/life.elf", "life.elf", 0755);
|
testlib_extract("/zip/life.elf", "life.elf", 0755);
|
||||||
testlib_extract("/zip/life-pe.com", "life-pe.com", 0755);
|
testlib_extract("/zip/life-pe", "life-pe", 0755);
|
||||||
kprintf("%s %s (MODE=" MODE
|
kprintf("%s %s (MODE=" MODE
|
||||||
" rss=%'zu tiny64=%'zu life.com=%'zu life.elf=%'zu)\n",
|
" rss=%'zu tiny64=%'zu life=%'zu life.elf=%'zu)\n",
|
||||||
__describe_os(), GetHost(), GetRss(), GetSize("tiny64"),
|
__describe_os(), GetHost(), GetRss(), GetSize("tiny64"),
|
||||||
GetSize("life.com"), GetSize("life.elf"));
|
GetSize("life"), GetSize("life.elf"));
|
||||||
ForkExecveWait("./life.com");
|
ForkExecveWait("./life");
|
||||||
EZBENCH2("posix_spawn life.com", donothing, PosixSpawnWait("./life.com"));
|
EZBENCH2("posix_spawn life", donothing, PosixSpawnWait("./life"));
|
||||||
EZBENCH2("vfork life.com", donothing, VforkExecveWait("./life.com"));
|
EZBENCH2("vfork life", donothing, VforkExecveWait("./life"));
|
||||||
EZBENCH2("fork life.com", donothing, ForkExecveWait("./life.com"));
|
EZBENCH2("fork life", donothing, ForkExecveWait("./life"));
|
||||||
if (IsWindows()) {
|
if (IsWindows()) {
|
||||||
EZBENCH2("posix_spawn life-pe.com", donothing,
|
EZBENCH2("posix_spawn life-pe", donothing, PosixSpawnWait("./life-pe"));
|
||||||
PosixSpawnWait("./life-pe.com"));
|
EZBENCH2("vfork life-pe", donothing, VforkExecveWait("./life-pe"));
|
||||||
EZBENCH2("vfork life-pe.com", donothing, VforkExecveWait("./life-pe.com"));
|
EZBENCH2("fork life-pe", donothing, ForkExecveWait("./life-pe"));
|
||||||
EZBENCH2("fork life-pe.com", donothing, ForkExecveWait("./life-pe.com"));
|
|
||||||
}
|
}
|
||||||
if (IsXnu() || IsWindows() || IsMetal()) return;
|
if (IsXnu() || IsWindows() || IsMetal()) return;
|
||||||
EZBENCH2("posix_spawn life.elf", donothing, PosixSpawnWait("./life.elf"));
|
EZBENCH2("posix_spawn life.elf", donothing, PosixSpawnWait("./life.elf"));
|
||||||
|
|
|
@ -21,7 +21,6 @@
|
||||||
#include "libc/dce.h"
|
#include "libc/dce.h"
|
||||||
#include "libc/intrin/kprintf.h"
|
#include "libc/intrin/kprintf.h"
|
||||||
#include "libc/mem/gc.h"
|
#include "libc/mem/gc.h"
|
||||||
#include "libc/mem/gc.h"
|
|
||||||
#include "libc/paths.h"
|
#include "libc/paths.h"
|
||||||
#include "libc/runtime/runtime.h"
|
#include "libc/runtime/runtime.h"
|
||||||
#include "libc/stdio/stdio.h"
|
#include "libc/stdio/stdio.h"
|
||||||
|
@ -81,14 +80,14 @@ TEST(system, exit) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(system, testStdoutRedirect) {
|
TEST(system, testStdoutRedirect) {
|
||||||
testlib_extract("/zip/echo.com", "echo.com", 0755);
|
testlib_extract("/zip/echo", "echo", 0755);
|
||||||
ASSERT_EQ(0, system("./echo.com hello >hello.txt"));
|
ASSERT_EQ(0, system("./echo hello >hello.txt"));
|
||||||
EXPECT_STREQ("hello\n", gc(xslurp("hello.txt", 0)));
|
EXPECT_STREQ("hello\n", gc(xslurp("hello.txt", 0)));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(system, testStdoutRedirect_withSpacesInFilename) {
|
TEST(system, testStdoutRedirect_withSpacesInFilename) {
|
||||||
testlib_extract("/zip/echo.com", "echo.com", 0755);
|
testlib_extract("/zip/echo", "echo", 0755);
|
||||||
ASSERT_EQ(0, system("./echo.com hello >\"hello there.txt\""));
|
ASSERT_EQ(0, system("./echo hello >\"hello there.txt\""));
|
||||||
EXPECT_STREQ("hello\n", gc(xslurp("hello there.txt", 0)));
|
EXPECT_STREQ("hello\n", gc(xslurp("hello there.txt", 0)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -109,10 +108,10 @@ TEST(system, testStderrRedirect_toStdout) {
|
||||||
buf[1] = 0;
|
buf[1] = 0;
|
||||||
buf[2] = 0;
|
buf[2] = 0;
|
||||||
buf[3] = 0;
|
buf[3] = 0;
|
||||||
testlib_extract("/zip/echo.com", "echo.com", 0755);
|
testlib_extract("/zip/echo", "echo", 0755);
|
||||||
ASSERT_NE(-1, dup2(1, 2));
|
ASSERT_NE(-1, dup2(1, 2));
|
||||||
success = false;
|
success = false;
|
||||||
if (GETEXITSTATUS(system("./echo.com aaa 2>&1")) == 0) {
|
if (GETEXITSTATUS(system("./echo aaa 2>&1")) == 0) {
|
||||||
success = read(pipefd[0], buf, 4) == (4);
|
success = read(pipefd[0], buf, 4) == (4);
|
||||||
}
|
}
|
||||||
ASSERT_NE(-1, dup2(stderrBack, 2));
|
ASSERT_NE(-1, dup2(stderrBack, 2));
|
||||||
|
@ -176,17 +175,17 @@ TEST(system, kill) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(system, exitStatusPreservedAfterSemiColon) {
|
TEST(system, exitStatusPreservedAfterSemiColon) {
|
||||||
testlib_extract("/zip/false.com", "false.com", 0755);
|
testlib_extract("/zip/false", "false", 0755);
|
||||||
ASSERT_EQ(1, GETEXITSTATUS(system("false;")));
|
ASSERT_EQ(1, GETEXITSTATUS(system("false;")));
|
||||||
ASSERT_EQ(1, GETEXITSTATUS(system("false; ")));
|
ASSERT_EQ(1, GETEXITSTATUS(system("false; ")));
|
||||||
ASSERT_EQ(1, GETEXITSTATUS(system("./false.com;")));
|
ASSERT_EQ(1, GETEXITSTATUS(system("./false;")));
|
||||||
ASSERT_EQ(1, GETEXITSTATUS(system("./false.com;")));
|
ASSERT_EQ(1, GETEXITSTATUS(system("./false;")));
|
||||||
CaptureStdout();
|
CaptureStdout();
|
||||||
ASSERT_EQ(0, GETEXITSTATUS(system("false; echo $?")));
|
ASSERT_EQ(0, GETEXITSTATUS(system("false; echo $?")));
|
||||||
char buf[9] = {0};
|
char buf[9] = {0};
|
||||||
ASSERT_EQ(2, read(pipefd[0], buf, 8));
|
ASSERT_EQ(2, read(pipefd[0], buf, 8));
|
||||||
ASSERT_STREQ("1\n", buf);
|
ASSERT_STREQ("1\n", buf);
|
||||||
ASSERT_EQ(0, GETEXITSTATUS(system("./false.com; echo $?")));
|
ASSERT_EQ(0, GETEXITSTATUS(system("./false; echo $?")));
|
||||||
ASSERT_EQ(2, read(pipefd[0], buf, 8));
|
ASSERT_EQ(2, read(pipefd[0], buf, 8));
|
||||||
ASSERT_STREQ("1\n", buf);
|
ASSERT_STREQ("1\n", buf);
|
||||||
ASSERT_EQ(0, GETEXITSTATUS(system("echo -n hi")));
|
ASSERT_EQ(0, GETEXITSTATUS(system("echo -n hi")));
|
||||||
|
@ -222,17 +221,17 @@ TEST(system, allowsLoneCloseCurlyBrace) {
|
||||||
ASSERT_EQ(5, read(pipefd[0], buf, 5));
|
ASSERT_EQ(5, read(pipefd[0], buf, 5));
|
||||||
ASSERT_STREQ("aaa}\n", buf);
|
ASSERT_STREQ("aaa}\n", buf);
|
||||||
bzero(buf, 6);
|
bzero(buf, 6);
|
||||||
testlib_extract("/zip/echo.com", "echo.com", 0755);
|
testlib_extract("/zip/echo", "echo", 0755);
|
||||||
ASSERT_EQ(0, GETEXITSTATUS(system("./echo.com \"aaa\"}")));
|
ASSERT_EQ(0, GETEXITSTATUS(system("./echo \"aaa\"}")));
|
||||||
ASSERT_EQ(5, read(pipefd[0], buf, 5));
|
ASSERT_EQ(5, read(pipefd[0], buf, 5));
|
||||||
ASSERT_STREQ("aaa}\n", buf);
|
ASSERT_STREQ("aaa}\n", buf);
|
||||||
RestoreStdout();
|
RestoreStdout();
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(system, glob) {
|
TEST(system, glob) {
|
||||||
testlib_extract("/zip/echo.com", "echo.com", 0755);
|
testlib_extract("/zip/echo", "echo", 0755);
|
||||||
ASSERT_EQ(0, system("./ec*.com aaa"));
|
ASSERT_EQ(0, system("./ec* aaa"));
|
||||||
ASSERT_EQ(0, system("./ec?o.com aaa"));
|
ASSERT_EQ(0, system("./ec?o aaa"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(system, env) {
|
TEST(system, env) {
|
||||||
|
@ -253,8 +252,8 @@ TEST(system, env) {
|
||||||
TEST(system, pipelineCanOutputToFile) {
|
TEST(system, pipelineCanOutputToFile) {
|
||||||
ASSERT_EQ(0, GETEXITSTATUS(system("echo hello | tr a-z A-Z >res")));
|
ASSERT_EQ(0, GETEXITSTATUS(system("echo hello | tr a-z A-Z >res")));
|
||||||
ASSERT_STREQ("HELLO\n", gc(xslurp("res", 0)));
|
ASSERT_STREQ("HELLO\n", gc(xslurp("res", 0)));
|
||||||
testlib_extract("/zip/echo.com", "echo.com", 0755);
|
testlib_extract("/zip/echo", "echo", 0755);
|
||||||
ASSERT_EQ(0, GETEXITSTATUS(system("./echo.com hello | tr a-z A-Z >res")));
|
ASSERT_EQ(0, GETEXITSTATUS(system("./echo hello | tr a-z A-Z >res")));
|
||||||
ASSERT_STREQ("HELLO\n", gc(xslurp("res", 0)));
|
ASSERT_STREQ("HELLO\n", gc(xslurp("res", 0)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -267,11 +266,11 @@ TEST(system, pipelineCanOutputBackToSelf) {
|
||||||
ASSERT_EQ(0, GETEXITSTATUS(system("echo hello | exec tr a-z A-Z")));
|
ASSERT_EQ(0, GETEXITSTATUS(system("echo hello | exec tr a-z A-Z")));
|
||||||
ASSERT_SYS(0, 6, read(pipefd[0], buf, 16));
|
ASSERT_SYS(0, 6, read(pipefd[0], buf, 16));
|
||||||
ASSERT_STREQ("HELLO\n", buf);
|
ASSERT_STREQ("HELLO\n", buf);
|
||||||
testlib_extract("/zip/echo.com", "echo.com", 0755);
|
testlib_extract("/zip/echo", "echo", 0755);
|
||||||
ASSERT_EQ(0, GETEXITSTATUS(system("./echo.com hello | tr a-z A-Z")));
|
ASSERT_EQ(0, GETEXITSTATUS(system("./echo hello | tr a-z A-Z")));
|
||||||
ASSERT_SYS(0, 6, read(pipefd[0], buf, 16));
|
ASSERT_SYS(0, 6, read(pipefd[0], buf, 16));
|
||||||
ASSERT_STREQ("HELLO\n", buf);
|
ASSERT_STREQ("HELLO\n", buf);
|
||||||
ASSERT_EQ(0, GETEXITSTATUS(system("./echo.com hello | exec tr a-z A-Z")));
|
ASSERT_EQ(0, GETEXITSTATUS(system("./echo hello | exec tr a-z A-Z")));
|
||||||
ASSERT_SYS(0, 6, read(pipefd[0], buf, 16));
|
ASSERT_SYS(0, 6, read(pipefd[0], buf, 16));
|
||||||
ASSERT_STREQ("HELLO\n", buf);
|
ASSERT_STREQ("HELLO\n", buf);
|
||||||
RestoreStdout();
|
RestoreStdout();
|
||||||
|
@ -280,10 +279,10 @@ TEST(system, pipelineCanOutputBackToSelf) {
|
||||||
int system2(const char *);
|
int system2(const char *);
|
||||||
|
|
||||||
BENCH(system, bench) {
|
BENCH(system, bench) {
|
||||||
testlib_extract("/zip/echo.com", "echo.com", 0755);
|
testlib_extract("/zip/echo", "echo", 0755);
|
||||||
EZBENCH2("system cmd", donothing, system("./echo.com hi >/dev/null"));
|
EZBENCH2("system cmd", donothing, system("./echo hi >/dev/null"));
|
||||||
EZBENCH2("systemvpe cmd", donothing,
|
EZBENCH2("systemvpe cmd", donothing,
|
||||||
systemvpe("./echo.com", (char *[]){"./echo.com", "hi", 0}, 0));
|
systemvpe("./echo", (char *[]){"./echo", "hi", 0}, 0));
|
||||||
EZBENCH2("cocmd echo", donothing, system("echo hi >/dev/null"));
|
EZBENCH2("cocmd echo", donothing, system("echo hi >/dev/null"));
|
||||||
EZBENCH2("cocmd exit", donothing, system("exit"));
|
EZBENCH2("cocmd exit", donothing, system("exit"));
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,9 +14,9 @@ o/$(MODE)/test/libc/release/cosmopolitan.zip: \
|
||||||
o/$(MODE)/ape/ape-copy-self.o \
|
o/$(MODE)/ape/ape-copy-self.o \
|
||||||
o/$(MODE)/ape/ape-no-modify-self.o \
|
o/$(MODE)/ape/ape-no-modify-self.o \
|
||||||
o/$(MODE)/cosmopolitan.a \
|
o/$(MODE)/cosmopolitan.a \
|
||||||
o/$(MODE)/third_party/zip/zip.com
|
o/$(MODE)/third_party/zip/zip
|
||||||
@$(COMPILE) -AZIP -T$@ \
|
@$(COMPILE) -AZIP -T$@ \
|
||||||
o/$(MODE)/third_party/zip/zip.com \
|
o/$(MODE)/third_party/zip/zip \
|
||||||
-b$(TMPDIR) -qj $@ \
|
-b$(TMPDIR) -qj $@ \
|
||||||
o/cosmopolitan.h \
|
o/cosmopolitan.h \
|
||||||
o/$(MODE)/ape/ape.lds \
|
o/$(MODE)/ape/ape.lds \
|
||||||
|
@ -46,7 +46,7 @@ o/$(MODE)/test/libc/release/smoke.o: \
|
||||||
-Wl,-z,noexecstack \
|
-Wl,-z,noexecstack \
|
||||||
$<
|
$<
|
||||||
|
|
||||||
o/$(MODE)/test/libc/release/smoke.com.dbg: \
|
o/$(MODE)/test/libc/release/smoke.dbg: \
|
||||||
o/$(MODE)/test/libc/release/smoke.o \
|
o/$(MODE)/test/libc/release/smoke.o \
|
||||||
o/$(MODE)/ape/ape.lds \
|
o/$(MODE)/ape/ape.lds \
|
||||||
o/$(MODE)/libc/crt/crt.o \
|
o/$(MODE)/libc/crt/crt.o \
|
||||||
|
@ -67,7 +67,7 @@ o/$(MODE)/test/libc/release/smoke.com.dbg: \
|
||||||
o/$(MODE)/cosmopolitan.a \
|
o/$(MODE)/cosmopolitan.a \
|
||||||
-o $@
|
-o $@
|
||||||
|
|
||||||
o/$(MODE)/test/libc/release/smoke-nms.com.dbg: \
|
o/$(MODE)/test/libc/release/smoke-nms.dbg: \
|
||||||
o/$(MODE)/test/libc/release/smoke.o \
|
o/$(MODE)/test/libc/release/smoke.o \
|
||||||
o/$(MODE)/ape/ape.lds \
|
o/$(MODE)/ape/ape.lds \
|
||||||
o/$(MODE)/libc/crt/crt.o \
|
o/$(MODE)/libc/crt/crt.o \
|
||||||
|
@ -88,13 +88,13 @@ o/$(MODE)/test/libc/release/smoke-nms.com.dbg: \
|
||||||
o/$(MODE)/cosmopolitan.a \
|
o/$(MODE)/cosmopolitan.a \
|
||||||
-o $@
|
-o $@
|
||||||
|
|
||||||
o/$(MODE)/test/libc/release/smoke-chibicc.com.dbg: \
|
o/$(MODE)/test/libc/release/smoke-chibicc.dbg: \
|
||||||
o/$(MODE)/test/libc/release/smoke-chibicc.o \
|
o/$(MODE)/test/libc/release/smoke-chibicc.o \
|
||||||
o/$(MODE)/ape/ape.lds \
|
o/$(MODE)/ape/ape.lds \
|
||||||
o/$(MODE)/libc/crt/crt.o \
|
o/$(MODE)/libc/crt/crt.o \
|
||||||
o/$(MODE)/ape/ape-no-modify-self.o \
|
o/$(MODE)/ape/ape-no-modify-self.o \
|
||||||
o/$(MODE)/cosmopolitan.a \
|
o/$(MODE)/cosmopolitan.a \
|
||||||
o/$(MODE)/third_party/chibicc/chibicc.com
|
o/$(MODE)/third_party/chibicc/chibicc
|
||||||
@$(COMPILE) -ALD $(LD) \
|
@$(COMPILE) -ALD $(LD) \
|
||||||
-static \
|
-static \
|
||||||
-no-pie \
|
-no-pie \
|
||||||
|
@ -113,9 +113,9 @@ o/$(MODE)/test/libc/release/smoke-chibicc.com.dbg: \
|
||||||
o/$(MODE)/test/libc/release/smoke-chibicc.o: \
|
o/$(MODE)/test/libc/release/smoke-chibicc.o: \
|
||||||
test/libc/release/smoke.c \
|
test/libc/release/smoke.c \
|
||||||
o/cosmopolitan.h \
|
o/cosmopolitan.h \
|
||||||
o/$(MODE)/third_party/chibicc/chibicc.com
|
o/$(MODE)/third_party/chibicc/chibicc
|
||||||
@$(COMPILE) -wACHIBICC \
|
@$(COMPILE) -wACHIBICC \
|
||||||
o/$(MODE)/third_party/chibicc/chibicc.com \
|
o/$(MODE)/third_party/chibicc/chibicc \
|
||||||
$(CHIBICC_FLAGS) \
|
$(CHIBICC_FLAGS) \
|
||||||
-o $@ \
|
-o $@ \
|
||||||
-c \
|
-c \
|
||||||
|
@ -131,7 +131,7 @@ o/$(MODE)/test/libc/release/smoke-chibicc.o: \
|
||||||
-include o/cosmopolitan.h \
|
-include o/cosmopolitan.h \
|
||||||
$<
|
$<
|
||||||
|
|
||||||
o/$(MODE)/test/libc/release/smokecxx.com.dbg: \
|
o/$(MODE)/test/libc/release/smokecxx.dbg: \
|
||||||
o/$(MODE)/test/libc/release/smokecxx.o \
|
o/$(MODE)/test/libc/release/smokecxx.o \
|
||||||
o/$(MODE)/ape/ape.lds \
|
o/$(MODE)/ape/ape.lds \
|
||||||
o/$(MODE)/libc/crt/crt.o \
|
o/$(MODE)/libc/crt/crt.o \
|
||||||
|
@ -171,7 +171,7 @@ o/$(MODE)/test/libc/release/smokecxx.o: \
|
||||||
-include o/cosmopolitan.h \
|
-include o/cosmopolitan.h \
|
||||||
test/libc/release/smokecxx.cc
|
test/libc/release/smokecxx.cc
|
||||||
|
|
||||||
o/$(MODE)/test/libc/release/smokeansi.com.dbg: \
|
o/$(MODE)/test/libc/release/smokeansi.dbg: \
|
||||||
o/$(MODE)/test/libc/release/smokeansi.o \
|
o/$(MODE)/test/libc/release/smokeansi.o \
|
||||||
o/$(MODE)/ape/ape.lds \
|
o/$(MODE)/ape/ape.lds \
|
||||||
o/$(MODE)/libc/crt/crt.o \
|
o/$(MODE)/libc/crt/crt.o \
|
||||||
|
@ -216,27 +216,27 @@ o/$(MODE)/test/libc/release/smokeansi.o: \
|
||||||
# TODO(jart): Rewrite these shell scripts as C code.
|
# TODO(jart): Rewrite these shell scripts as C code.
|
||||||
# o/$(MODE)/test/libc/release/metal.ok: \
|
# o/$(MODE)/test/libc/release/metal.ok: \
|
||||||
# test/libc/release/metal.sh \
|
# test/libc/release/metal.sh \
|
||||||
# o/$(MODE)/examples/hello.com \
|
# o/$(MODE)/examples/hello \
|
||||||
# o/$(MODE)/tool/build/blinkenlights.com.dbg
|
# o/$(MODE)/tool/build/blinkenlights.dbg
|
||||||
# @$(COMPILE) -ASHTEST -tT$@ $<
|
# @$(COMPILE) -ASHTEST -tT$@ $<
|
||||||
# o/$(MODE)/test/libc/release/emulate.ok: \
|
# o/$(MODE)/test/libc/release/emulate.ok: \
|
||||||
# test/libc/release/emulate.sh \
|
# test/libc/release/emulate.sh \
|
||||||
# o/$(MODE)/examples/hello.com \
|
# o/$(MODE)/examples/hello \
|
||||||
# o/$(MODE)/tool/build/blinkenlights.com.dbg
|
# o/$(MODE)/tool/build/blinkenlights.dbg
|
||||||
# @$(COMPILE) -ASHTEST -tT$@ $<
|
# @$(COMPILE) -ASHTEST -tT$@ $<
|
||||||
|
|
||||||
.PHONY: o/$(MODE)/test/libc/release
|
.PHONY: o/$(MODE)/test/libc/release
|
||||||
o/$(MODE)/test/libc/release: \
|
o/$(MODE)/test/libc/release: \
|
||||||
o/$(MODE)/test/libc/release/smoke.com \
|
o/$(MODE)/test/libc/release/smoke \
|
||||||
o/$(MODE)/test/libc/release/smoke.com.runs \
|
o/$(MODE)/test/libc/release/smoke.runs \
|
||||||
o/$(MODE)/test/libc/release/smoke-nms.com \
|
o/$(MODE)/test/libc/release/smoke-nms \
|
||||||
o/$(MODE)/test/libc/release/smoke-nms.com.runs \
|
o/$(MODE)/test/libc/release/smoke-nms.runs \
|
||||||
o/$(MODE)/test/libc/release/smoke-chibicc.com \
|
o/$(MODE)/test/libc/release/smoke-chibicc \
|
||||||
o/$(MODE)/test/libc/release/smoke-chibicc.com.runs \
|
o/$(MODE)/test/libc/release/smoke-chibicc.runs \
|
||||||
o/$(MODE)/test/libc/release/smokecxx.com \
|
o/$(MODE)/test/libc/release/smokecxx \
|
||||||
o/$(MODE)/test/libc/release/smokecxx.com.runs \
|
o/$(MODE)/test/libc/release/smokecxx.runs \
|
||||||
o/$(MODE)/test/libc/release/smokeansi.com \
|
o/$(MODE)/test/libc/release/smokeansi \
|
||||||
o/$(MODE)/test/libc/release/smokeansi.com.runs
|
o/$(MODE)/test/libc/release/smokeansi.runs
|
||||||
|
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -9,7 +9,7 @@ if [ "$MODE" = opt ] || [ "$MODE" = optlinux ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# smoke test userspace binary emulation
|
# smoke test userspace binary emulation
|
||||||
CMD="o/$MODE/tool/build/blinkenlights.com.dbg o/$MODE/examples/hello.com"
|
CMD="o/$MODE/tool/build/blinkenlights.dbg o/$MODE/examples/hello"
|
||||||
if OUTPUT="$($CMD)"; then
|
if OUTPUT="$($CMD)"; then
|
||||||
if [ x"$OUTPUT" = x"hello world" ]; then
|
if [ x"$OUTPUT" = x"hello world" ]; then
|
||||||
exit 0
|
exit 0
|
||||||
|
|
|
@ -13,7 +13,7 @@ fi
|
||||||
$MKDIR o/$MODE/test/libc/release/
|
$MKDIR o/$MODE/test/libc/release/
|
||||||
|
|
||||||
# smoke test booting on bare metal and printing data to serial uart
|
# smoke test booting on bare metal and printing data to serial uart
|
||||||
CMD="o/$MODE/tool/build/blinkenlights.com.dbg -r o/$MODE/examples/hello.com"
|
CMD="o/$MODE/tool/build/blinkenlights.dbg -r o/$MODE/examples/hello"
|
||||||
if OUTPUT="$($CMD)"; then
|
if OUTPUT="$($CMD)"; then
|
||||||
if [ x"$OUTPUT" = x"hello world" ]; then
|
if [ x"$OUTPUT" = x"hello world" ]; then
|
||||||
exit 0
|
exit 0
|
||||||
|
|
|
@ -10,17 +10,17 @@ TEST_LIBC_RUNTIME_OBJS = \
|
||||||
$(TEST_LIBC_RUNTIME_SRCS:%.c=o/$(MODE)/%.o)
|
$(TEST_LIBC_RUNTIME_SRCS:%.c=o/$(MODE)/%.o)
|
||||||
|
|
||||||
TEST_LIBC_RUNTIME_COMS = \
|
TEST_LIBC_RUNTIME_COMS = \
|
||||||
$(TEST_LIBC_RUNTIME_SRCS:%.c=o/$(MODE)/%.com)
|
$(TEST_LIBC_RUNTIME_SRCS:%.c=o/$(MODE)/%)
|
||||||
|
|
||||||
TEST_LIBC_RUNTIME_BINS = \
|
TEST_LIBC_RUNTIME_BINS = \
|
||||||
$(TEST_LIBC_RUNTIME_COMS) \
|
$(TEST_LIBC_RUNTIME_COMS) \
|
||||||
$(TEST_LIBC_RUNTIME_COMS:%=%.dbg)
|
$(TEST_LIBC_RUNTIME_COMS:%=%.dbg)
|
||||||
|
|
||||||
TEST_LIBC_RUNTIME_TESTS = \
|
TEST_LIBC_RUNTIME_TESTS = \
|
||||||
$(TEST_LIBC_RUNTIME_SRCS_TEST:%.c=o/$(MODE)/%.com.ok)
|
$(TEST_LIBC_RUNTIME_SRCS_TEST:%.c=o/$(MODE)/%.ok)
|
||||||
|
|
||||||
TEST_LIBC_RUNTIME_CHECKS = \
|
TEST_LIBC_RUNTIME_CHECKS = \
|
||||||
$(TEST_LIBC_RUNTIME_SRCS_TEST:%.c=o/$(MODE)/%.com.runs)
|
$(TEST_LIBC_RUNTIME_SRCS_TEST:%.c=o/$(MODE)/%.runs)
|
||||||
|
|
||||||
TEST_LIBC_RUNTIME_DIRECTDEPS = \
|
TEST_LIBC_RUNTIME_DIRECTDEPS = \
|
||||||
LIBC_CALLS \
|
LIBC_CALLS \
|
||||||
|
@ -49,7 +49,7 @@ o/$(MODE)/test/libc/runtime/runtime.pkg: \
|
||||||
$(TEST_LIBC_RUNTIME_OBJS) \
|
$(TEST_LIBC_RUNTIME_OBJS) \
|
||||||
$(foreach x,$(TEST_LIBC_RUNTIME_DIRECTDEPS),$($(x)_A).pkg)
|
$(foreach x,$(TEST_LIBC_RUNTIME_DIRECTDEPS),$($(x)_A).pkg)
|
||||||
|
|
||||||
o/$(MODE)/test/libc/runtime/%.com.dbg: \
|
o/$(MODE)/test/libc/runtime/%.dbg: \
|
||||||
$(TEST_LIBC_RUNTIME_DEPS) \
|
$(TEST_LIBC_RUNTIME_DEPS) \
|
||||||
o/$(MODE)/test/libc/mem/prog/life.elf.zip.o \
|
o/$(MODE)/test/libc/mem/prog/life.elf.zip.o \
|
||||||
o/$(MODE)/test/libc/runtime/prog/ftraceasm.txt.zip.o \
|
o/$(MODE)/test/libc/runtime/prog/ftraceasm.txt.zip.o \
|
||||||
|
@ -61,7 +61,7 @@ o/$(MODE)/test/libc/runtime/%.com.dbg: \
|
||||||
$(APE_NO_MODIFY_SELF)
|
$(APE_NO_MODIFY_SELF)
|
||||||
@$(APELINK)
|
@$(APELINK)
|
||||||
|
|
||||||
o/$(MODE)/test/libc/runtime/ape_test.com.dbg: \
|
o/$(MODE)/test/libc/runtime/ape_test.dbg: \
|
||||||
$(TEST_LIBC_RUNTIME_DEPS) \
|
$(TEST_LIBC_RUNTIME_DEPS) \
|
||||||
o/$(MODE)/test/libc/runtime/ape_test.o \
|
o/$(MODE)/test/libc/runtime/ape_test.o \
|
||||||
o/$(MODE)/test/libc/runtime/runtime.pkg \
|
o/$(MODE)/test/libc/runtime/runtime.pkg \
|
||||||
|
@ -74,8 +74,8 @@ $(TEST_LIBC_RUNTIME_OBJS): private \
|
||||||
DEFAULT_CCFLAGS += \
|
DEFAULT_CCFLAGS += \
|
||||||
-fno-builtin
|
-fno-builtin
|
||||||
|
|
||||||
o/$(MODE)/test/libc/runtime/getenv_test.com.runs: \
|
o/$(MODE)/test/libc/runtime/getenv_test.runs: \
|
||||||
o/$(MODE)/test/libc/runtime/getenv_test.com
|
o/$(MODE)/test/libc/runtime/getenv_test
|
||||||
@HELLO=THERE build/runit $@ $<
|
@HELLO=THERE build/runit $@ $<
|
||||||
|
|
||||||
o/$(MODE)/test/libc/runtime/itsatrap_test.o: private \
|
o/$(MODE)/test/libc/runtime/itsatrap_test.o: private \
|
||||||
|
|
|
@ -95,9 +95,9 @@ TEST(GetDosArgv, realWorldUsage) {
|
||||||
size_t size = ARG_MAX / 2;
|
size_t size = ARG_MAX / 2;
|
||||||
char *buf = malloc(size * sizeof(char));
|
char *buf = malloc(size * sizeof(char));
|
||||||
char **argv = malloc(max * sizeof(char *));
|
char **argv = malloc(max * sizeof(char *));
|
||||||
EXPECT_EQ(5, GetDosArgv(u"C:\\Users\\jtunn\\printargs.com oh yes yes yes",
|
EXPECT_EQ(5, GetDosArgv(u"C:\\Users\\jtunn\\printargs oh yes yes yes", buf,
|
||||||
buf, size, argv, max));
|
size, argv, max));
|
||||||
EXPECT_STREQ("C:\\Users\\jtunn\\printargs.com", argv[0]);
|
EXPECT_STREQ("C:\\Users\\jtunn\\printargs", argv[0]);
|
||||||
EXPECT_STREQ("oh", argv[1]);
|
EXPECT_STREQ("oh", argv[1]);
|
||||||
EXPECT_STREQ("yes", argv[2]);
|
EXPECT_STREQ("yes", argv[2]);
|
||||||
EXPECT_STREQ("yes", argv[3]);
|
EXPECT_STREQ("yes", argv[3]);
|
||||||
|
|
|
@ -6,85 +6,85 @@ PKGS += TEST_LIBC_SOCK
|
||||||
TEST_LIBC_SOCK_SRCS := $(wildcard test/libc/sock/*.c)
|
TEST_LIBC_SOCK_SRCS := $(wildcard test/libc/sock/*.c)
|
||||||
TEST_LIBC_SOCK_SRCS_TEST = $(filter %_test.c,$(TEST_LIBC_SOCK_SRCS))
|
TEST_LIBC_SOCK_SRCS_TEST = $(filter %_test.c,$(TEST_LIBC_SOCK_SRCS))
|
||||||
|
|
||||||
TEST_LIBC_SOCK_OBJS = \
|
TEST_LIBC_SOCK_OBJS = \
|
||||||
$(TEST_LIBC_SOCK_SRCS:%.c=o/$(MODE)/%.o)
|
$(TEST_LIBC_SOCK_SRCS:%.c=o/$(MODE)/%.o)
|
||||||
|
|
||||||
TEST_LIBC_SOCK_COMS = \
|
TEST_LIBC_SOCK_COMS = \
|
||||||
$(TEST_LIBC_SOCK_SRCS:%.c=o/$(MODE)/%.com)
|
$(TEST_LIBC_SOCK_SRCS:%.c=o/$(MODE)/%)
|
||||||
|
|
||||||
TEST_LIBC_SOCK_BINS = \
|
TEST_LIBC_SOCK_BINS = \
|
||||||
$(TEST_LIBC_SOCK_COMS) \
|
$(TEST_LIBC_SOCK_COMS) \
|
||||||
$(TEST_LIBC_SOCK_COMS:%=%.dbg)
|
$(TEST_LIBC_SOCK_COMS:%=%.dbg)
|
||||||
|
|
||||||
TEST_LIBC_SOCK_TESTS = \
|
TEST_LIBC_SOCK_TESTS = \
|
||||||
$(TEST_LIBC_SOCK_SRCS_TEST:%.c=o/$(MODE)/%.com.ok)
|
$(TEST_LIBC_SOCK_SRCS_TEST:%.c=o/$(MODE)/%.ok)
|
||||||
|
|
||||||
TEST_LIBC_SOCK_CHECKS = \
|
TEST_LIBC_SOCK_CHECKS = \
|
||||||
$(TEST_LIBC_SOCK_SRCS_TEST:%.c=o/$(MODE)/%.com.runs)
|
$(TEST_LIBC_SOCK_SRCS_TEST:%.c=o/$(MODE)/%.runs)
|
||||||
|
|
||||||
TEST_LIBC_SOCK_DIRECTDEPS = \
|
TEST_LIBC_SOCK_DIRECTDEPS = \
|
||||||
LIBC_CALLS \
|
LIBC_CALLS \
|
||||||
LIBC_FMT \
|
LIBC_FMT \
|
||||||
LIBC_INTRIN \
|
LIBC_INTRIN \
|
||||||
LIBC_MEM \
|
LIBC_MEM \
|
||||||
LIBC_NEXGEN32E \
|
LIBC_NEXGEN32E \
|
||||||
LIBC_PROC \
|
LIBC_PROC \
|
||||||
LIBC_RUNTIME \
|
LIBC_RUNTIME \
|
||||||
LIBC_SOCK \
|
LIBC_SOCK \
|
||||||
LIBC_STDIO \
|
LIBC_STDIO \
|
||||||
LIBC_STR \
|
LIBC_STR \
|
||||||
LIBC_SYSV \
|
LIBC_SYSV \
|
||||||
LIBC_THREAD \
|
LIBC_THREAD \
|
||||||
LIBC_LOG \
|
LIBC_LOG \
|
||||||
LIBC_SYSV_CALLS \
|
LIBC_SYSV_CALLS \
|
||||||
LIBC_TESTLIB \
|
LIBC_TESTLIB \
|
||||||
LIBC_X \
|
LIBC_X \
|
||||||
TOOL_DECODE_LIB
|
TOOL_DECODE_LIB
|
||||||
|
|
||||||
TEST_LIBC_SOCK_DEPS := \
|
TEST_LIBC_SOCK_DEPS := \
|
||||||
$(call uniq,$(foreach x,$(TEST_LIBC_SOCK_DIRECTDEPS),$($(x))))
|
$(call uniq,$(foreach x,$(TEST_LIBC_SOCK_DIRECTDEPS),$($(x))))
|
||||||
|
|
||||||
o/$(MODE)/test/libc/sock/sock.pkg: \
|
o/$(MODE)/test/libc/sock/sock.pkg: \
|
||||||
$(TEST_LIBC_SOCK_OBJS) \
|
$(TEST_LIBC_SOCK_OBJS) \
|
||||||
$(foreach x,$(TEST_LIBC_SOCK_DIRECTDEPS),$($(x)_A).pkg)
|
$(foreach x,$(TEST_LIBC_SOCK_DIRECTDEPS),$($(x)_A).pkg)
|
||||||
|
|
||||||
o/$(MODE)/test/libc/sock/%.com.dbg: \
|
o/$(MODE)/test/libc/sock/%.dbg: \
|
||||||
$(TEST_LIBC_SOCK_DEPS) \
|
$(TEST_LIBC_SOCK_DEPS) \
|
||||||
o/$(MODE)/test/libc/sock/%.o \
|
o/$(MODE)/test/libc/sock/%.o \
|
||||||
o/$(MODE)/test/libc/sock/sock.pkg \
|
o/$(MODE)/test/libc/sock/sock.pkg \
|
||||||
$(LIBC_TESTMAIN) \
|
$(LIBC_TESTMAIN) \
|
||||||
$(CRT) \
|
$(CRT) \
|
||||||
$(APE_NO_MODIFY_SELF)
|
$(APE_NO_MODIFY_SELF)
|
||||||
@$(APELINK)
|
@$(APELINK)
|
||||||
|
|
||||||
o/$(MODE)/test/libc/sock/unix_test.com.runs: \
|
o/$(MODE)/test/libc/sock/unix_test.runs: \
|
||||||
private .PLEDGE = stdio rpath wpath cpath fattr proc unix
|
private .PLEDGE = stdio rpath wpath cpath fattr proc unix
|
||||||
|
|
||||||
o/$(MODE)/test/libc/sock/connect_test.com.runs \
|
o/$(MODE)/test/libc/sock/connect_test.runs \
|
||||||
o/$(MODE)/test/libc/sock/recvfrom_test.com.runs \
|
o/$(MODE)/test/libc/sock/recvfrom_test.runs \
|
||||||
o/$(MODE)/test/libc/sock/nonblock_test.com.runs \
|
o/$(MODE)/test/libc/sock/nonblock_test.runs \
|
||||||
o/$(MODE)/test/libc/sock/socket_test.com.runs \
|
o/$(MODE)/test/libc/sock/socket_test.runs \
|
||||||
o/$(MODE)/test/libc/sock/shutdown_test.com.runs \
|
o/$(MODE)/test/libc/sock/shutdown_test.runs \
|
||||||
o/$(MODE)/test/libc/sock/setsockopt_test.com.runs \
|
o/$(MODE)/test/libc/sock/setsockopt_test.runs \
|
||||||
o/$(MODE)/test/libc/sock/sendfile_test.com.runs \
|
o/$(MODE)/test/libc/sock/sendfile_test.runs \
|
||||||
o/$(MODE)/test/libc/sock/poll_test.com.runs \
|
o/$(MODE)/test/libc/sock/poll_test.runs \
|
||||||
o/$(MODE)/test/libc/sock/pollfd_test.com.runs: \
|
o/$(MODE)/test/libc/sock/pollfd_test.runs: \
|
||||||
private .PLEDGE = stdio rpath wpath cpath fattr proc inet
|
private .PLEDGE = stdio rpath wpath cpath fattr proc inet
|
||||||
|
|
||||||
o/$(MODE)/test/libc/sock/sendrecvmsg_test.com.runs: \
|
o/$(MODE)/test/libc/sock/sendrecvmsg_test.runs: \
|
||||||
private .PLEDGE = stdio rpath wpath cpath fattr proc inet recvfd sendfd
|
private .PLEDGE = stdio rpath wpath cpath fattr proc inet recvfd sendfd
|
||||||
|
|
||||||
o/$(MODE)/test/libc/sock/socket_test.com.runs: \
|
o/$(MODE)/test/libc/sock/socket_test.runs: \
|
||||||
private .INTERNET = 1 # todo: ipv6 filtering
|
private .INTERNET = 1 # todo: ipv6 filtering
|
||||||
|
|
||||||
o/$(MODE)/test/libc/sock/recvmsg_test.com.runs: \
|
o/$(MODE)/test/libc/sock/recvmsg_test.runs: \
|
||||||
private .INTERNET = 1 # need to bind to 0.0.0.0
|
private .INTERNET = 1 # need to bind to 0.0.0.0
|
||||||
o/$(MODE)/test/libc/sock/recvmsg_test.com.runs: \
|
o/$(MODE)/test/libc/sock/recvmsg_test.runs: \
|
||||||
private .PLEDGE = stdio rpath wpath cpath fattr proc inet recvfd sendfd
|
private .PLEDGE = stdio rpath wpath cpath fattr proc inet recvfd sendfd
|
||||||
|
|
||||||
$(TEST_LIBC_SOCK_OBJS): test/libc/sock/BUILD.mk
|
$(TEST_LIBC_SOCK_OBJS): test/libc/sock/BUILD.mk
|
||||||
|
|
||||||
.PHONY: o/$(MODE)/test/libc/sock
|
.PHONY: o/$(MODE)/test/libc/sock
|
||||||
o/$(MODE)/test/libc/sock: \
|
o/$(MODE)/test/libc/sock: \
|
||||||
$(TEST_LIBC_SOCK_BINS) \
|
$(TEST_LIBC_SOCK_BINS) \
|
||||||
$(TEST_LIBC_SOCK_CHECKS)
|
$(TEST_LIBC_SOCK_CHECKS)
|
||||||
|
|
|
@ -12,17 +12,17 @@ TEST_LIBC_STDIO_OBJS = \
|
||||||
$(TEST_LIBC_STDIO_SRCS:%.c=o/$(MODE)/%.o)
|
$(TEST_LIBC_STDIO_SRCS:%.c=o/$(MODE)/%.o)
|
||||||
|
|
||||||
TEST_LIBC_STDIO_COMS = \
|
TEST_LIBC_STDIO_COMS = \
|
||||||
$(TEST_LIBC_STDIO_SRCS:%.c=o/$(MODE)/%.com)
|
$(TEST_LIBC_STDIO_SRCS:%.c=o/$(MODE)/%)
|
||||||
|
|
||||||
TEST_LIBC_STDIO_BINS = \
|
TEST_LIBC_STDIO_BINS = \
|
||||||
$(TEST_LIBC_STDIO_COMS) \
|
$(TEST_LIBC_STDIO_COMS) \
|
||||||
$(TEST_LIBC_STDIO_COMS:%=%.dbg)
|
$(TEST_LIBC_STDIO_COMS:%=%.dbg)
|
||||||
|
|
||||||
TEST_LIBC_STDIO_TESTS = \
|
TEST_LIBC_STDIO_TESTS = \
|
||||||
$(TEST_LIBC_STDIO_SRCS_TEST:%.c=o/$(MODE)/%.com.ok)
|
$(TEST_LIBC_STDIO_SRCS_TEST:%.c=o/$(MODE)/%.ok)
|
||||||
|
|
||||||
TEST_LIBC_STDIO_CHECKS = \
|
TEST_LIBC_STDIO_CHECKS = \
|
||||||
$(TEST_LIBC_STDIO_SRCS_TEST:%.c=o/$(MODE)/%.com.runs)
|
$(TEST_LIBC_STDIO_SRCS_TEST:%.c=o/$(MODE)/%.runs)
|
||||||
|
|
||||||
TEST_LIBC_STDIO_DIRECTDEPS = \
|
TEST_LIBC_STDIO_DIRECTDEPS = \
|
||||||
LIBC_CALLS \
|
LIBC_CALLS \
|
||||||
|
@ -55,21 +55,21 @@ o/$(MODE)/test/libc/stdio/stdio.pkg: \
|
||||||
$(TEST_LIBC_STDIO_OBJS) \
|
$(TEST_LIBC_STDIO_OBJS) \
|
||||||
$(foreach x,$(TEST_LIBC_STDIO_DIRECTDEPS),$($(x)_A).pkg)
|
$(foreach x,$(TEST_LIBC_STDIO_DIRECTDEPS),$($(x)_A).pkg)
|
||||||
|
|
||||||
o/$(MODE)/test/libc/stdio/%.com.dbg: \
|
o/$(MODE)/test/libc/stdio/%.dbg: \
|
||||||
$(TEST_LIBC_STDIO_DEPS) \
|
$(TEST_LIBC_STDIO_DEPS) \
|
||||||
o/$(MODE)/test/libc/stdio/%.o \
|
o/$(MODE)/test/libc/stdio/%.o \
|
||||||
o/$(MODE)/test/libc/stdio/stdio.pkg \
|
o/$(MODE)/test/libc/stdio/stdio.pkg \
|
||||||
o/$(MODE)/tool/build/echo.com.zip.o \
|
o/$(MODE)/tool/build/echo.zip.o \
|
||||||
$(LIBC_TESTMAIN) \
|
$(LIBC_TESTMAIN) \
|
||||||
$(CRT) \
|
$(CRT) \
|
||||||
$(APE_NO_MODIFY_SELF)
|
$(APE_NO_MODIFY_SELF)
|
||||||
@$(APELINK)
|
@$(APELINK)
|
||||||
|
|
||||||
o/$(MODE)/test/libc/stdio/popen_test.com.dbg: \
|
o/$(MODE)/test/libc/stdio/popen_test.dbg: \
|
||||||
$(TEST_LIBC_STDIO_DEPS) \
|
$(TEST_LIBC_STDIO_DEPS) \
|
||||||
o/$(MODE)/test/libc/stdio/popen_test.o \
|
o/$(MODE)/test/libc/stdio/popen_test.o \
|
||||||
o/$(MODE)/test/libc/stdio/stdio.pkg \
|
o/$(MODE)/test/libc/stdio/stdio.pkg \
|
||||||
o/$(MODE)/tool/build/echo.com.zip.o \
|
o/$(MODE)/tool/build/echo.zip.o \
|
||||||
$(LIBC_TESTMAIN) \
|
$(LIBC_TESTMAIN) \
|
||||||
$(CRT) \
|
$(CRT) \
|
||||||
$(APE_NO_MODIFY_SELF)
|
$(APE_NO_MODIFY_SELF)
|
||||||
|
|
|
@ -27,7 +27,6 @@
|
||||||
#include "libc/limits.h"
|
#include "libc/limits.h"
|
||||||
#include "libc/mem/critbit0.h"
|
#include "libc/mem/critbit0.h"
|
||||||
#include "libc/mem/gc.h"
|
#include "libc/mem/gc.h"
|
||||||
#include "libc/mem/gc.h"
|
|
||||||
#include "libc/mem/mem.h"
|
#include "libc/mem/mem.h"
|
||||||
#include "libc/runtime/runtime.h"
|
#include "libc/runtime/runtime.h"
|
||||||
#include "libc/stdio/append.h"
|
#include "libc/stdio/append.h"
|
||||||
|
@ -424,7 +423,7 @@ static int walk(const char *fpath, //
|
||||||
|
|
||||||
TEST(dirstream, walk) {
|
TEST(dirstream, walk) {
|
||||||
ASSERT_SYS(0, 0, nftw("/zip", walk, 128, FTW_PHYS | FTW_DEPTH));
|
ASSERT_SYS(0, 0, nftw("/zip", walk, 128, FTW_PHYS | FTW_DEPTH));
|
||||||
ASSERT_STREQ("FTW_F /zip/echo.com\n"
|
ASSERT_STREQ("FTW_F /zip/echo\n"
|
||||||
"FTW_F /zip/libc/testlib/hyperion.txt\n"
|
"FTW_F /zip/libc/testlib/hyperion.txt\n"
|
||||||
"FTW_F /zip/libc/testlib/moby.txt\n"
|
"FTW_F /zip/libc/testlib/moby.txt\n"
|
||||||
"FTW_DP /zip/libc/testlib\n"
|
"FTW_DP /zip/libc/testlib\n"
|
||||||
|
|
|
@ -62,8 +62,8 @@ void CheckForFdLeaks(void) {
|
||||||
|
|
||||||
TEST(popen, command) {
|
TEST(popen, command) {
|
||||||
char foo[6];
|
char foo[6];
|
||||||
testlib_extract("/zip/echo.com", "echo.com", 0755);
|
testlib_extract("/zip/echo", "echo", 0755);
|
||||||
ASSERT_NE(NULL, (f = popen("./echo.com hello", "r")));
|
ASSERT_NE(NULL, (f = popen("./echo hello", "r")));
|
||||||
ASSERT_NE(NULL, fgets(foo, sizeof(foo), f));
|
ASSERT_NE(NULL, fgets(foo, sizeof(foo), f));
|
||||||
ASSERT_STREQ("hello", foo);
|
ASSERT_STREQ("hello", foo);
|
||||||
ASSERT_EQ(0, pclose(f));
|
ASSERT_EQ(0, pclose(f));
|
||||||
|
@ -142,7 +142,7 @@ void *Worker(void *arg) {
|
||||||
arg2 = malloc(13);
|
arg2 = malloc(13);
|
||||||
FormatInt32(arg1, _rand64());
|
FormatInt32(arg1, _rand64());
|
||||||
FormatInt32(arg2, _rand64());
|
FormatInt32(arg2, _rand64());
|
||||||
sprintf(cmd, "echo %s; ./echo.com %s", arg1, arg2);
|
sprintf(cmd, "echo %s; ./echo %s", arg1, arg2);
|
||||||
strcat(arg1, "\n");
|
strcat(arg1, "\n");
|
||||||
strcat(arg2, "\n");
|
strcat(arg2, "\n");
|
||||||
ASSERT_NE(NULL, (f = popen(cmd, "r")));
|
ASSERT_NE(NULL, (f = popen(cmd, "r")));
|
||||||
|
@ -163,7 +163,7 @@ TEST(popen, torture) {
|
||||||
}
|
}
|
||||||
int i, n = 4;
|
int i, n = 4;
|
||||||
pthread_t *t = gc(malloc(sizeof(pthread_t) * n));
|
pthread_t *t = gc(malloc(sizeof(pthread_t) * n));
|
||||||
testlib_extract("/zip/echo.com", "echo.com", 0755);
|
testlib_extract("/zip/echo", "echo", 0755);
|
||||||
for (i = 0; i < n; ++i) ASSERT_EQ(0, pthread_create(t + i, 0, Worker, 0));
|
for (i = 0; i < n; ++i) ASSERT_EQ(0, pthread_create(t + i, 0, Worker, 0));
|
||||||
for (i = 0; i < n; ++i) ASSERT_EQ(0, pthread_join(t[i], 0));
|
for (i = 0; i < n; ++i) ASSERT_EQ(0, pthread_join(t[i], 0));
|
||||||
CheckForFdLeaks();
|
CheckForFdLeaks();
|
||||||
|
|
|
@ -101,7 +101,7 @@ TEST(zipdir, testListZip) {
|
||||||
ASSERT_STREQ("..", ent->d_name);
|
ASSERT_STREQ("..", ent->d_name);
|
||||||
ASSERT_EQ(DT_DIR, ent->d_type);
|
ASSERT_EQ(DT_DIR, ent->d_type);
|
||||||
ASSERT_NE(NULL, (ent = readdir(dir)));
|
ASSERT_NE(NULL, (ent = readdir(dir)));
|
||||||
ASSERT_STREQ("echo.com", ent->d_name);
|
ASSERT_STREQ("echo", ent->d_name);
|
||||||
ASSERT_EQ(DT_REG, ent->d_type);
|
ASSERT_EQ(DT_REG, ent->d_type);
|
||||||
ASSERT_NE(NULL, (ent = readdir(dir)));
|
ASSERT_NE(NULL, (ent = readdir(dir)));
|
||||||
ASSERT_STREQ("libc", ent->d_name);
|
ASSERT_STREQ("libc", ent->d_name);
|
||||||
|
|
|
@ -10,78 +10,78 @@ TEST_LIBC_STR_SRCS = $(TEST_LIBC_STR_SRCS_C) $(TEST_LIBC_STR_SRCS_CC)
|
||||||
TEST_LIBC_STR_SRCS_TEST_C = $(filter %_test.c,$(TEST_LIBC_STR_FILES))
|
TEST_LIBC_STR_SRCS_TEST_C = $(filter %_test.c,$(TEST_LIBC_STR_FILES))
|
||||||
TEST_LIBC_STR_SRCS_TEST_CC = $(filter %_test.cc,$(TEST_LIBC_STR_FILES))
|
TEST_LIBC_STR_SRCS_TEST_CC = $(filter %_test.cc,$(TEST_LIBC_STR_FILES))
|
||||||
|
|
||||||
TEST_LIBC_STR_OBJS = \
|
TEST_LIBC_STR_OBJS = \
|
||||||
$(TEST_LIBC_STR_SRCS_C:%.c=o/$(MODE)/%.o) \
|
$(TEST_LIBC_STR_SRCS_C:%.c=o/$(MODE)/%.o) \
|
||||||
$(TEST_LIBC_STR_SRCS_CC:%.cc=o/$(MODE)/%.o)
|
$(TEST_LIBC_STR_SRCS_CC:%.cc=o/$(MODE)/%.o)
|
||||||
|
|
||||||
TEST_LIBC_STR_COMS = \
|
TEST_LIBC_STR_COMS = \
|
||||||
$(TEST_LIBC_STR_SRCS_TEST_C:%.c=o/$(MODE)/%.com) \
|
$(TEST_LIBC_STR_SRCS_TEST_C:%.c=o/$(MODE)/%) \
|
||||||
$(TEST_LIBC_STR_SRCS_TEST_CC:%.cc=o/$(MODE)/%.com)
|
$(TEST_LIBC_STR_SRCS_TEST_CC:%.cc=o/$(MODE)/%)
|
||||||
|
|
||||||
TEST_LIBC_STR_BINS = \
|
TEST_LIBC_STR_BINS = \
|
||||||
$(TEST_LIBC_STR_COMS) \
|
$(TEST_LIBC_STR_COMS) \
|
||||||
$(TEST_LIBC_STR_COMS:%=%.dbg)
|
$(TEST_LIBC_STR_COMS:%=%.dbg)
|
||||||
|
|
||||||
TEST_LIBC_STR_TESTS = \
|
TEST_LIBC_STR_TESTS = \
|
||||||
$(TEST_LIBC_STR_SRCS_TEST_C:%.c=o/$(MODE)/%.com.ok) \
|
$(TEST_LIBC_STR_SRCS_TEST_C:%.c=o/$(MODE)/%.ok) \
|
||||||
$(TEST_LIBC_STR_SRCS_TEST_CC:%.cc=o/$(MODE)/%.com.ok)
|
$(TEST_LIBC_STR_SRCS_TEST_CC:%.cc=o/$(MODE)/%.ok)
|
||||||
|
|
||||||
TEST_LIBC_STR_CHECKS = \
|
TEST_LIBC_STR_CHECKS = \
|
||||||
$(TEST_LIBC_STR_SRCS_TEST_C:%.c=o/$(MODE)/%.com.runs) \
|
$(TEST_LIBC_STR_SRCS_TEST_C:%.c=o/$(MODE)/%.runs) \
|
||||||
$(TEST_LIBC_STR_SRCS_TEST_CC:%.cc=o/$(MODE)/%.com.runs)
|
$(TEST_LIBC_STR_SRCS_TEST_CC:%.cc=o/$(MODE)/%.runs)
|
||||||
|
|
||||||
TEST_LIBC_STR_DIRECTDEPS = \
|
TEST_LIBC_STR_DIRECTDEPS = \
|
||||||
LIBC_CALLS \
|
LIBC_CALLS \
|
||||||
LIBC_FMT \
|
LIBC_FMT \
|
||||||
LIBC_INTRIN \
|
LIBC_INTRIN \
|
||||||
LIBC_LOG \
|
LIBC_LOG \
|
||||||
LIBC_TINYMATH \
|
LIBC_TINYMATH \
|
||||||
LIBC_MEM \
|
LIBC_MEM \
|
||||||
LIBC_NEXGEN32E \
|
LIBC_NEXGEN32E \
|
||||||
LIBC_RUNTIME \
|
LIBC_RUNTIME \
|
||||||
LIBC_STDIO \
|
LIBC_STDIO \
|
||||||
LIBC_STR \
|
LIBC_STR \
|
||||||
LIBC_SYSV \
|
LIBC_SYSV \
|
||||||
LIBC_SYSV_CALLS \
|
LIBC_SYSV_CALLS \
|
||||||
LIBC_TESTLIB \
|
LIBC_TESTLIB \
|
||||||
LIBC_X \
|
LIBC_X \
|
||||||
THIRD_PARTY_COMPILER_RT \
|
THIRD_PARTY_COMPILER_RT \
|
||||||
THIRD_PARTY_MBEDTLS \
|
THIRD_PARTY_MBEDTLS \
|
||||||
THIRD_PARTY_REGEX \
|
THIRD_PARTY_REGEX \
|
||||||
THIRD_PARTY_ZLIB \
|
THIRD_PARTY_ZLIB \
|
||||||
THIRD_PARTY_LIBCXX \
|
THIRD_PARTY_LIBCXX \
|
||||||
THIRD_PARTY_SMALLZ4 \
|
THIRD_PARTY_SMALLZ4 \
|
||||||
THIRD_PARTY_VQSORT
|
THIRD_PARTY_VQSORT
|
||||||
|
|
||||||
TEST_LIBC_STR_DEPS := \
|
TEST_LIBC_STR_DEPS := \
|
||||||
$(call uniq,$(foreach x,$(TEST_LIBC_STR_DIRECTDEPS),$($(x))))
|
$(call uniq,$(foreach x,$(TEST_LIBC_STR_DIRECTDEPS),$($(x))))
|
||||||
|
|
||||||
o/$(MODE)/test/libc/str/str.pkg: \
|
o/$(MODE)/test/libc/str/str.pkg: \
|
||||||
$(TEST_LIBC_STR_OBJS) \
|
$(TEST_LIBC_STR_OBJS) \
|
||||||
$(foreach x,$(TEST_LIBC_STR_DIRECTDEPS),$($(x)_A).pkg)
|
$(foreach x,$(TEST_LIBC_STR_DIRECTDEPS),$($(x)_A).pkg)
|
||||||
|
|
||||||
o/$(MODE)/test/libc/str/tpenc_test.o: private \
|
o/$(MODE)/test/libc/str/tpenc_test.o: private \
|
||||||
CFLAGS += \
|
CFLAGS += \
|
||||||
$(TRADITIONAL)
|
$(TRADITIONAL)
|
||||||
|
|
||||||
o/$(MODE)/test/libc/str/%.com.dbg: \
|
o/$(MODE)/test/libc/str/%.dbg: \
|
||||||
$(TEST_LIBC_STR_DEPS) \
|
$(TEST_LIBC_STR_DEPS) \
|
||||||
o/$(MODE)/test/libc/str/%.o \
|
o/$(MODE)/test/libc/str/%.o \
|
||||||
o/$(MODE)/test/libc/str/str.pkg \
|
o/$(MODE)/test/libc/str/str.pkg \
|
||||||
$(LIBC_TESTMAIN) \
|
$(LIBC_TESTMAIN) \
|
||||||
$(CRT) \
|
$(CRT) \
|
||||||
$(APE_NO_MODIFY_SELF)
|
$(APE_NO_MODIFY_SELF)
|
||||||
@$(APELINK)
|
@$(APELINK)
|
||||||
|
|
||||||
$(TEST_LIBC_STR_OBJS): private \
|
$(TEST_LIBC_STR_OBJS): private \
|
||||||
DEFAULT_CCFLAGS += \
|
DEFAULT_CCFLAGS += \
|
||||||
-fno-builtin
|
-fno-builtin
|
||||||
|
|
||||||
o/$(MODE)/test/libc/str/memmove_test.o: private \
|
o/$(MODE)/test/libc/str/memmove_test.o: private \
|
||||||
CFLAGS += \
|
CFLAGS += \
|
||||||
-O2 -D_FORTIFY_SOURCE=2
|
-O2 -D_FORTIFY_SOURCE=2
|
||||||
|
|
||||||
.PHONY: o/$(MODE)/test/libc/str
|
.PHONY: o/$(MODE)/test/libc/str
|
||||||
o/$(MODE)/test/libc/str: \
|
o/$(MODE)/test/libc/str: \
|
||||||
$(TEST_LIBC_STR_BINS) \
|
$(TEST_LIBC_STR_BINS) \
|
||||||
$(TEST_LIBC_STR_CHECKS)
|
$(TEST_LIBC_STR_CHECKS)
|
||||||
|
|
|
@ -38,7 +38,7 @@ TEST(regex, testDns) {
|
||||||
regex_t rx;
|
regex_t rx;
|
||||||
EXPECT_EQ(REG_OK, regcomp(&rx, "^[-._0-9A-Za-z]*$", REG_EXTENDED));
|
EXPECT_EQ(REG_OK, regcomp(&rx, "^[-._0-9A-Za-z]*$", REG_EXTENDED));
|
||||||
EXPECT_EQ(REG_OK, regexec(&rx, "", 0, NULL, 0));
|
EXPECT_EQ(REG_OK, regexec(&rx, "", 0, NULL, 0));
|
||||||
EXPECT_EQ(REG_OK, regexec(&rx, "foo.com", 0, NULL, 0));
|
EXPECT_EQ(REG_OK, regexec(&rx, "foo", 0, NULL, 0));
|
||||||
EXPECT_EQ(REG_NOMATCH, regexec(&rx, "bar@example", 0, NULL, 0));
|
EXPECT_EQ(REG_NOMATCH, regexec(&rx, "bar@example", 0, NULL, 0));
|
||||||
regfree(&rx);
|
regfree(&rx);
|
||||||
}
|
}
|
||||||
|
@ -96,16 +96,16 @@ TEST(regex, testUnicodeCharacterClass) {
|
||||||
void A(void) {
|
void A(void) {
|
||||||
regex_t rx;
|
regex_t rx;
|
||||||
regcomp(&rx, "^[-._0-9A-Za-z]*$", REG_EXTENDED);
|
regcomp(&rx, "^[-._0-9A-Za-z]*$", REG_EXTENDED);
|
||||||
regexec(&rx, "foo.com", 0, NULL, 0);
|
regexec(&rx, "foo", 0, NULL, 0);
|
||||||
regfree(&rx);
|
regfree(&rx);
|
||||||
}
|
}
|
||||||
void B(regex_t *rx) {
|
void B(regex_t *rx) {
|
||||||
regexec(rx, "foo.com", 0, NULL, 0);
|
regexec(rx, "foo", 0, NULL, 0);
|
||||||
}
|
}
|
||||||
void C(void) {
|
void C(void) {
|
||||||
regex_t rx;
|
regex_t rx;
|
||||||
regcomp(&rx, "^[-._0-9A-Za-z]*$", 0);
|
regcomp(&rx, "^[-._0-9A-Za-z]*$", 0);
|
||||||
regexec(&rx, "foo.com", 0, NULL, 0);
|
regexec(&rx, "foo", 0, NULL, 0);
|
||||||
regfree(&rx);
|
regfree(&rx);
|
||||||
}
|
}
|
||||||
void D(regex_t *rx, regmatch_t *m) {
|
void D(regex_t *rx, regmatch_t *m) {
|
||||||
|
|
|
@ -16,17 +16,17 @@ TEST_LIBC_THREAD_OBJS = \
|
||||||
$(TEST_LIBC_THREAD_SRCS_CC:%.cc=o/$(MODE)/%.o)
|
$(TEST_LIBC_THREAD_SRCS_CC:%.cc=o/$(MODE)/%.o)
|
||||||
|
|
||||||
TEST_LIBC_THREAD_COMS = \
|
TEST_LIBC_THREAD_COMS = \
|
||||||
$(TEST_LIBC_THREAD_OBJS:%.o=%.com)
|
$(TEST_LIBC_THREAD_OBJS:%.o=%)
|
||||||
|
|
||||||
TEST_LIBC_THREAD_BINS = \
|
TEST_LIBC_THREAD_BINS = \
|
||||||
$(TEST_LIBC_THREAD_COMS) \
|
$(TEST_LIBC_THREAD_COMS) \
|
||||||
$(TEST_LIBC_THREAD_COMS:%=%.dbg)
|
$(TEST_LIBC_THREAD_COMS:%=%.dbg)
|
||||||
|
|
||||||
TEST_LIBC_THREAD_TESTS = \
|
TEST_LIBC_THREAD_TESTS = \
|
||||||
$(TEST_LIBC_THREAD_OBJS:%.o=%.com.ok)
|
$(TEST_LIBC_THREAD_OBJS:%.o=%.ok)
|
||||||
|
|
||||||
TEST_LIBC_THREAD_CHECKS = \
|
TEST_LIBC_THREAD_CHECKS = \
|
||||||
$(TEST_LIBC_THREAD_OBJS:%.o=%.com.runs)
|
$(TEST_LIBC_THREAD_OBJS:%.o=%.runs)
|
||||||
|
|
||||||
TEST_LIBC_THREAD_DIRECTDEPS = \
|
TEST_LIBC_THREAD_DIRECTDEPS = \
|
||||||
LIBC_CALLS \
|
LIBC_CALLS \
|
||||||
|
@ -58,7 +58,7 @@ o/$(MODE)/test/libc/thread/thread.pkg: \
|
||||||
$(TEST_LIBC_THREAD_OBJS) \
|
$(TEST_LIBC_THREAD_OBJS) \
|
||||||
$(foreach x,$(TEST_LIBC_THREAD_DIRECTDEPS),$($(x)_A).pkg)
|
$(foreach x,$(TEST_LIBC_THREAD_DIRECTDEPS),$($(x)_A).pkg)
|
||||||
|
|
||||||
o/$(MODE)/test/libc/thread/%.com.dbg: \
|
o/$(MODE)/test/libc/thread/%.dbg: \
|
||||||
$(TEST_LIBC_THREAD_DEPS) \
|
$(TEST_LIBC_THREAD_DEPS) \
|
||||||
o/$(MODE)/test/libc/thread/%.o \
|
o/$(MODE)/test/libc/thread/%.o \
|
||||||
o/$(MODE)/test/libc/thread/thread.pkg \
|
o/$(MODE)/test/libc/thread/thread.pkg \
|
||||||
|
@ -67,7 +67,7 @@ o/$(MODE)/test/libc/thread/%.com.dbg: \
|
||||||
$(APE_NO_MODIFY_SELF)
|
$(APE_NO_MODIFY_SELF)
|
||||||
@$(APELINK)
|
@$(APELINK)
|
||||||
|
|
||||||
o/$(MODE)/test/libc/thread/pthread_kill_test.com.runs: \
|
o/$(MODE)/test/libc/thread/pthread_kill_test.runs: \
|
||||||
private .PLEDGE = stdio rpath wpath cpath fattr proc inet
|
private .PLEDGE = stdio rpath wpath cpath fattr proc inet
|
||||||
|
|
||||||
.PHONY: o/$(MODE)/test/libc/thread
|
.PHONY: o/$(MODE)/test/libc/thread
|
||||||
|
|
|
@ -11,11 +11,11 @@ TEST_LIBC_TIME_OBJS = \
|
||||||
$(TEST_LIBC_TIME_SRCS:%.c=o/$(MODE)/%.o)
|
$(TEST_LIBC_TIME_SRCS:%.c=o/$(MODE)/%.o)
|
||||||
|
|
||||||
TEST_LIBC_TIME_COMS = \
|
TEST_LIBC_TIME_COMS = \
|
||||||
$(TEST_LIBC_TIME_SRCS:%.c=o/$(MODE)/%.com)
|
$(TEST_LIBC_TIME_SRCS:%.c=o/$(MODE)/%)
|
||||||
|
|
||||||
TEST_LIBC_TIME_TESTS = $(TEST_LIBC_TIME_SRCS_TEST:%.c=o/$(MODE)/%.com.ok)
|
TEST_LIBC_TIME_TESTS = $(TEST_LIBC_TIME_SRCS_TEST:%.c=o/$(MODE)/%.ok)
|
||||||
TEST_LIBC_TIME_CHECKS = \
|
TEST_LIBC_TIME_CHECKS = \
|
||||||
$(TEST_LIBC_TIME_SRCS_TEST:%.c=o/$(MODE)/%.com.runs)
|
$(TEST_LIBC_TIME_SRCS_TEST:%.c=o/$(MODE)/%.runs)
|
||||||
|
|
||||||
TEST_LIBC_TIME_DIRECTDEPS = \
|
TEST_LIBC_TIME_DIRECTDEPS = \
|
||||||
LIBC_CALLS \
|
LIBC_CALLS \
|
||||||
|
@ -36,7 +36,7 @@ o/$(MODE)/test/libc/time/time.pkg: \
|
||||||
$(TEST_LIBC_TIME_OBJS) \
|
$(TEST_LIBC_TIME_OBJS) \
|
||||||
$(foreach x,$(TEST_LIBC_TIME_DIRECTDEPS),$($(x)_A).pkg)
|
$(foreach x,$(TEST_LIBC_TIME_DIRECTDEPS),$($(x)_A).pkg)
|
||||||
|
|
||||||
o/$(MODE)/test/libc/time/%.com.dbg: \
|
o/$(MODE)/test/libc/time/%.dbg: \
|
||||||
$(TEST_LIBC_TIME_DEPS) \
|
$(TEST_LIBC_TIME_DEPS) \
|
||||||
o/$(MODE)/test/libc/time/%.o \
|
o/$(MODE)/test/libc/time/%.o \
|
||||||
o/$(MODE)/test/libc/time/time.pkg \
|
o/$(MODE)/test/libc/time/time.pkg \
|
||||||
|
|
|
@ -10,17 +10,17 @@ TEST_LIBC_TINYMATH_OBJS = \
|
||||||
$(TEST_LIBC_TINYMATH_SRCS:%.c=o/$(MODE)/%.o)
|
$(TEST_LIBC_TINYMATH_SRCS:%.c=o/$(MODE)/%.o)
|
||||||
|
|
||||||
TEST_LIBC_TINYMATH_COMS = \
|
TEST_LIBC_TINYMATH_COMS = \
|
||||||
$(TEST_LIBC_TINYMATH_SRCS:%.c=o/$(MODE)/%.com)
|
$(TEST_LIBC_TINYMATH_SRCS:%.c=o/$(MODE)/%)
|
||||||
|
|
||||||
TEST_LIBC_TINYMATH_BINS = \
|
TEST_LIBC_TINYMATH_BINS = \
|
||||||
$(TEST_LIBC_TINYMATH_COMS) \
|
$(TEST_LIBC_TINYMATH_COMS) \
|
||||||
$(TEST_LIBC_TINYMATH_COMS:%=%.dbg)
|
$(TEST_LIBC_TINYMATH_COMS:%=%.dbg)
|
||||||
|
|
||||||
TEST_LIBC_TINYMATH_TESTS = \
|
TEST_LIBC_TINYMATH_TESTS = \
|
||||||
$(TEST_LIBC_TINYMATH_SRCS_TEST:%.c=o/$(MODE)/%.com.ok)
|
$(TEST_LIBC_TINYMATH_SRCS_TEST:%.c=o/$(MODE)/%.ok)
|
||||||
|
|
||||||
TEST_LIBC_TINYMATH_CHECKS = \
|
TEST_LIBC_TINYMATH_CHECKS = \
|
||||||
$(TEST_LIBC_TINYMATH_SRCS_TEST:%.c=o/$(MODE)/%.com.runs)
|
$(TEST_LIBC_TINYMATH_SRCS_TEST:%.c=o/$(MODE)/%.runs)
|
||||||
|
|
||||||
TEST_LIBC_TINYMATH_DIRECTDEPS = \
|
TEST_LIBC_TINYMATH_DIRECTDEPS = \
|
||||||
LIBC_CALLS \
|
LIBC_CALLS \
|
||||||
|
@ -47,7 +47,7 @@ o/$(MODE)/test/libc/tinymath/tinymath.pkg: \
|
||||||
$(TEST_LIBC_TINYMATH_OBJS) \
|
$(TEST_LIBC_TINYMATH_OBJS) \
|
||||||
$(foreach x,$(TEST_LIBC_TINYMATH_DIRECTDEPS),$($(x)_A).pkg)
|
$(foreach x,$(TEST_LIBC_TINYMATH_DIRECTDEPS),$($(x)_A).pkg)
|
||||||
|
|
||||||
o/$(MODE)/test/libc/tinymath/%.com.dbg: \
|
o/$(MODE)/test/libc/tinymath/%.dbg: \
|
||||||
$(TEST_LIBC_TINYMATH_DEPS) \
|
$(TEST_LIBC_TINYMATH_DEPS) \
|
||||||
o/$(MODE)/test/libc/tinymath/%.o \
|
o/$(MODE)/test/libc/tinymath/%.o \
|
||||||
o/$(MODE)/test/libc/tinymath/tinymath.pkg \
|
o/$(MODE)/test/libc/tinymath/tinymath.pkg \
|
||||||
|
|
|
@ -10,17 +10,17 @@ TEST_LIBC_X_OBJS = \
|
||||||
$(TEST_LIBC_X_SRCS:%.c=o/$(MODE)/%.o)
|
$(TEST_LIBC_X_SRCS:%.c=o/$(MODE)/%.o)
|
||||||
|
|
||||||
TEST_LIBC_X_COMS = \
|
TEST_LIBC_X_COMS = \
|
||||||
$(TEST_LIBC_X_SRCS:%.c=o/$(MODE)/%.com)
|
$(TEST_LIBC_X_SRCS:%.c=o/$(MODE)/%)
|
||||||
|
|
||||||
TEST_LIBC_X_BINS = \
|
TEST_LIBC_X_BINS = \
|
||||||
$(TEST_LIBC_X_COMS) \
|
$(TEST_LIBC_X_COMS) \
|
||||||
$(TEST_LIBC_X_COMS:%=%.dbg)
|
$(TEST_LIBC_X_COMS:%=%.dbg)
|
||||||
|
|
||||||
TEST_LIBC_X_TESTS = \
|
TEST_LIBC_X_TESTS = \
|
||||||
$(TEST_LIBC_X_SRCS_TEST:%.c=o/$(MODE)/%.com.ok)
|
$(TEST_LIBC_X_SRCS_TEST:%.c=o/$(MODE)/%.ok)
|
||||||
|
|
||||||
TEST_LIBC_X_CHECKS = \
|
TEST_LIBC_X_CHECKS = \
|
||||||
$(TEST_LIBC_X_SRCS_TEST:%.c=o/$(MODE)/%.com.runs)
|
$(TEST_LIBC_X_SRCS_TEST:%.c=o/$(MODE)/%.runs)
|
||||||
|
|
||||||
TEST_LIBC_X_DIRECTDEPS = \
|
TEST_LIBC_X_DIRECTDEPS = \
|
||||||
LIBC_CALLS \
|
LIBC_CALLS \
|
||||||
|
@ -45,7 +45,7 @@ o/$(MODE)/test/libc/x/x.pkg: \
|
||||||
$(TEST_LIBC_X_OBJS) \
|
$(TEST_LIBC_X_OBJS) \
|
||||||
$(foreach x,$(TEST_LIBC_X_DIRECTDEPS),$($(x)_A).pkg)
|
$(foreach x,$(TEST_LIBC_X_DIRECTDEPS),$($(x)_A).pkg)
|
||||||
|
|
||||||
o/$(MODE)/test/libc/x/%.com.dbg: \
|
o/$(MODE)/test/libc/x/%.dbg: \
|
||||||
$(TEST_LIBC_X_DEPS) \
|
$(TEST_LIBC_X_DEPS) \
|
||||||
o/$(MODE)/test/libc/x/%.o \
|
o/$(MODE)/test/libc/x/%.o \
|
||||||
o/$(MODE)/test/libc/x/x.pkg \
|
o/$(MODE)/test/libc/x/x.pkg \
|
||||||
|
|
|
@ -56,17 +56,17 @@ TEST_LIBC_XED_OBJS = \
|
||||||
$(TEST_LIBC_XED_SRCS:%.c=o/$(MODE)/%.o)
|
$(TEST_LIBC_XED_SRCS:%.c=o/$(MODE)/%.o)
|
||||||
|
|
||||||
TEST_LIBC_XED_COMS = \
|
TEST_LIBC_XED_COMS = \
|
||||||
$(TEST_LIBC_XED_SRCS:%.c=o/$(MODE)/%.com)
|
$(TEST_LIBC_XED_SRCS:%.c=o/$(MODE)/%)
|
||||||
|
|
||||||
TEST_LIBC_XED_BINS = \
|
TEST_LIBC_XED_BINS = \
|
||||||
$(TEST_LIBC_XED_COMS) \
|
$(TEST_LIBC_XED_COMS) \
|
||||||
$(TEST_LIBC_XED_COMS:%=%.dbg)
|
$(TEST_LIBC_XED_COMS:%=%.dbg)
|
||||||
|
|
||||||
TEST_LIBC_XED_TESTS = \
|
TEST_LIBC_XED_TESTS = \
|
||||||
$(TEST_LIBC_XED_SRCS:%.c=o/$(MODE)/%.com.ok)
|
$(TEST_LIBC_XED_SRCS:%.c=o/$(MODE)/%.ok)
|
||||||
|
|
||||||
TEST_LIBC_XED_CHECKS = \
|
TEST_LIBC_XED_CHECKS = \
|
||||||
$(TEST_LIBC_XED_SRCS:%.c=o/$(MODE)/%.com.runs)
|
$(TEST_LIBC_XED_SRCS:%.c=o/$(MODE)/%.runs)
|
||||||
|
|
||||||
TEST_LIBC_XED_DIRECTDEPS = \
|
TEST_LIBC_XED_DIRECTDEPS = \
|
||||||
LIBC_INTRIN \
|
LIBC_INTRIN \
|
||||||
|
@ -85,7 +85,7 @@ o/$(MODE)/test/libc/xed/xed.pkg: \
|
||||||
$(TEST_LIBC_XED_OBJS) \
|
$(TEST_LIBC_XED_OBJS) \
|
||||||
$(foreach x,$(TEST_LIBC_XED_DIRECTDEPS),$($(x)_A).pkg)
|
$(foreach x,$(TEST_LIBC_XED_DIRECTDEPS),$($(x)_A).pkg)
|
||||||
|
|
||||||
o/$(MODE)/test/libc/xed/%.com.dbg: \
|
o/$(MODE)/test/libc/xed/%.dbg: \
|
||||||
$(TEST_LIBC_XED_DEPS) \
|
$(TEST_LIBC_XED_DEPS) \
|
||||||
o/$(MODE)/test/libc/xed/%.o \
|
o/$(MODE)/test/libc/xed/%.o \
|
||||||
o/$(MODE)/test/libc/xed/xed.pkg \
|
o/$(MODE)/test/libc/xed/xed.pkg \
|
||||||
|
|
|
@ -6,7 +6,7 @@ PKGS += TEST_LIBCXX
|
||||||
TEST_LIBCXX_FILES := $(wildcard test/libcxx/*)
|
TEST_LIBCXX_FILES := $(wildcard test/libcxx/*)
|
||||||
TEST_LIBCXX_SRCS = $(filter %.cc,$(TEST_LIBCXX_FILES))
|
TEST_LIBCXX_SRCS = $(filter %.cc,$(TEST_LIBCXX_FILES))
|
||||||
TEST_LIBCXX_OBJS = $(TEST_LIBCXX_SRCS:%.cc=o/$(MODE)/%.o)
|
TEST_LIBCXX_OBJS = $(TEST_LIBCXX_SRCS:%.cc=o/$(MODE)/%.o)
|
||||||
TEST_LIBCXX_COMS = $(TEST_LIBCXX_OBJS:%.o=%.com)
|
TEST_LIBCXX_COMS = $(TEST_LIBCXX_OBJS:%.o=%)
|
||||||
TEST_LIBCXX_BINS = $(TEST_LIBCXX_COMS) $(TEST_LIBCXX_COMS:%=%.dbg)
|
TEST_LIBCXX_BINS = $(TEST_LIBCXX_COMS) $(TEST_LIBCXX_COMS:%=%.dbg)
|
||||||
TEST_LIBCXX_CHECKS = $(TEST_LIBCXX_COMS:%=%.runs)
|
TEST_LIBCXX_CHECKS = $(TEST_LIBCXX_COMS:%=%.runs)
|
||||||
TEST_LIBCXX_TESTS = $(TEST_LIBCXX_COMS:%=%.ok)
|
TEST_LIBCXX_TESTS = $(TEST_LIBCXX_COMS:%=%.ok)
|
||||||
|
@ -31,7 +31,7 @@ o/$(MODE)/test/libcxx/libcxx.pkg: \
|
||||||
$(TEST_LIBCXX_OBJS) \
|
$(TEST_LIBCXX_OBJS) \
|
||||||
$(foreach x,$(TEST_LIBCXX_DIRECTDEPS),$($(x)_A).pkg)
|
$(foreach x,$(TEST_LIBCXX_DIRECTDEPS),$($(x)_A).pkg)
|
||||||
|
|
||||||
o/$(MODE)/test/libcxx/%.com.dbg: \
|
o/$(MODE)/test/libcxx/%.dbg: \
|
||||||
$(TEST_LIBCXX_DEPS) \
|
$(TEST_LIBCXX_DEPS) \
|
||||||
o/$(MODE)/test/libcxx/%.o \
|
o/$(MODE)/test/libcxx/%.o \
|
||||||
o/$(MODE)/test/libcxx/libcxx.pkg \
|
o/$(MODE)/test/libcxx/libcxx.pkg \
|
||||||
|
@ -42,7 +42,7 @@ o/$(MODE)/test/libcxx/%.com.dbg: \
|
||||||
$(TEST_LIBCXX_OBJS): private CCFLAGS += -fexceptions -frtti
|
$(TEST_LIBCXX_OBJS): private CCFLAGS += -fexceptions -frtti
|
||||||
|
|
||||||
o/$(MODE)/test/libcxx/openmp_test.o: private CXXFLAGS += -fopenmp
|
o/$(MODE)/test/libcxx/openmp_test.o: private CXXFLAGS += -fopenmp
|
||||||
o/$(MODE)/test/libcxx/openmp_test.com.runs: private QUOTA += -C100
|
o/$(MODE)/test/libcxx/openmp_test.runs: private QUOTA += -C100
|
||||||
|
|
||||||
.PHONY: o/$(MODE)/test/libcxx
|
.PHONY: o/$(MODE)/test/libcxx
|
||||||
o/$(MODE)/test/libcxx: \
|
o/$(MODE)/test/libcxx: \
|
||||||
|
|
|
@ -6,10 +6,10 @@ PKGS += TEST_MATH
|
||||||
TEST_MATH_SRCS := $(wildcard test/math/*.c)
|
TEST_MATH_SRCS := $(wildcard test/math/*.c)
|
||||||
TEST_MATH_SRCS_TEST = $(filter %_test.c,$(TEST_MATH_SRCS))
|
TEST_MATH_SRCS_TEST = $(filter %_test.c,$(TEST_MATH_SRCS))
|
||||||
TEST_MATH_OBJS = $(TEST_MATH_SRCS:%.c=o/$(MODE)/%.o)
|
TEST_MATH_OBJS = $(TEST_MATH_SRCS:%.c=o/$(MODE)/%.o)
|
||||||
TEST_MATH_COMS = $(TEST_MATH_SRCS_TEST:%.c=o/$(MODE)/%.com)
|
TEST_MATH_COMS = $(TEST_MATH_SRCS_TEST:%.c=o/$(MODE)/%)
|
||||||
TEST_MATH_BINS = $(TEST_MATH_COMS) $(TEST_MATH_COMS:%=%.dbg)
|
TEST_MATH_BINS = $(TEST_MATH_COMS) $(TEST_MATH_COMS:%=%.dbg)
|
||||||
TEST_MATH_TESTS = $(TEST_MATH_SRCS_TEST:%.c=o/$(MODE)/%.com.ok)
|
TEST_MATH_TESTS = $(TEST_MATH_SRCS_TEST:%.c=o/$(MODE)/%.ok)
|
||||||
TEST_MATH_CHECKS = $(TEST_MATH_SRCS_TEST:%.c=o/$(MODE)/%.com.runs)
|
TEST_MATH_CHECKS = $(TEST_MATH_SRCS_TEST:%.c=o/$(MODE)/%.runs)
|
||||||
|
|
||||||
TEST_MATH_DIRECTDEPS = \
|
TEST_MATH_DIRECTDEPS = \
|
||||||
LIBC_INTRIN \
|
LIBC_INTRIN \
|
||||||
|
@ -25,9 +25,9 @@ o/$(MODE)/test/math/math.pkg: \
|
||||||
$(TEST_MATH_OBJS) \
|
$(TEST_MATH_OBJS) \
|
||||||
$(foreach x,$(TEST_MATH_DIRECTDEPS),$($(x)_A).pkg)
|
$(foreach x,$(TEST_MATH_DIRECTDEPS),$($(x)_A).pkg)
|
||||||
|
|
||||||
o/$(MODE)/test/math/%.com.dbg: \
|
o/$(MODE)/test/math/%.dbg: \
|
||||||
$(TEST_MATH_DEPS) \
|
$(TEST_MATH_DEPS) \
|
||||||
o/$(MODE)/test/math/%.o \
|
o/$(MODE)/test/math/%.o \
|
||||||
o/$(MODE)/test/math/math.pkg \
|
o/$(MODE)/test/math/math.pkg \
|
||||||
$(CRT) \
|
$(CRT) \
|
||||||
$(APE_NO_MODIFY_SELF)
|
$(APE_NO_MODIFY_SELF)
|
||||||
|
|
|
@ -11,13 +11,13 @@ TEST_NET_FINGER_OBJS = \
|
||||||
$(TEST_NET_FINGER_SRCS:%.c=o/$(MODE)/%.o)
|
$(TEST_NET_FINGER_SRCS:%.c=o/$(MODE)/%.o)
|
||||||
|
|
||||||
TEST_NET_FINGER_COMS = \
|
TEST_NET_FINGER_COMS = \
|
||||||
$(TEST_NET_FINGER_SRCS:%.c=o/$(MODE)/%.com)
|
$(TEST_NET_FINGER_SRCS:%.c=o/$(MODE)/%)
|
||||||
|
|
||||||
TEST_NET_FINGER_TESTS = \
|
TEST_NET_FINGER_TESTS = \
|
||||||
$(TEST_NET_FINGER_SRCS_TEST:%.c=o/$(MODE)/%.com.ok)
|
$(TEST_NET_FINGER_SRCS_TEST:%.c=o/$(MODE)/%.ok)
|
||||||
|
|
||||||
TEST_NET_FINGER_CHECKS = \
|
TEST_NET_FINGER_CHECKS = \
|
||||||
$(TEST_NET_FINGER_SRCS_TEST:%.c=o/$(MODE)/%.com.runs)
|
$(TEST_NET_FINGER_SRCS_TEST:%.c=o/$(MODE)/%.runs)
|
||||||
|
|
||||||
TEST_NET_FINGER_DIRECTDEPS = \
|
TEST_NET_FINGER_DIRECTDEPS = \
|
||||||
NET_FINGER \
|
NET_FINGER \
|
||||||
|
@ -32,7 +32,7 @@ o/$(MODE)/test/net/finger/finger.pkg: \
|
||||||
$(TEST_NET_FINGER_OBJS) \
|
$(TEST_NET_FINGER_OBJS) \
|
||||||
$(foreach x,$(TEST_NET_FINGER_DIRECTDEPS),$($(x)_A).pkg)
|
$(foreach x,$(TEST_NET_FINGER_DIRECTDEPS),$($(x)_A).pkg)
|
||||||
|
|
||||||
o/$(MODE)/test/net/finger/%.com.dbg: \
|
o/$(MODE)/test/net/finger/%.dbg: \
|
||||||
$(TEST_NET_FINGER_DEPS) \
|
$(TEST_NET_FINGER_DEPS) \
|
||||||
o/$(MODE)/test/net/finger/%.o \
|
o/$(MODE)/test/net/finger/%.o \
|
||||||
$(LIBC_TESTMAIN) \
|
$(LIBC_TESTMAIN) \
|
||||||
|
|
|
@ -13,17 +13,17 @@ TEST_POSIX_OBJS = \
|
||||||
$(TEST_POSIX_SRCS:%.c=o/$(MODE)/%.o)
|
$(TEST_POSIX_SRCS:%.c=o/$(MODE)/%.o)
|
||||||
|
|
||||||
TEST_POSIX_COMS = \
|
TEST_POSIX_COMS = \
|
||||||
$(TEST_POSIX_SRCS_TEST:%.c=o/$(MODE)/%.com)
|
$(TEST_POSIX_SRCS_TEST:%.c=o/$(MODE)/%)
|
||||||
|
|
||||||
TEST_POSIX_BINS = \
|
TEST_POSIX_BINS = \
|
||||||
$(TEST_POSIX_COMS) \
|
$(TEST_POSIX_COMS) \
|
||||||
$(TEST_POSIX_COMS:%=%.dbg)
|
$(TEST_POSIX_COMS:%=%.dbg)
|
||||||
|
|
||||||
TEST_POSIX_TESTS = \
|
TEST_POSIX_TESTS = \
|
||||||
$(TEST_POSIX_SRCS_TEST:%.c=o/$(MODE)/%.com.ok)
|
$(TEST_POSIX_SRCS_TEST:%.c=o/$(MODE)/%.ok)
|
||||||
|
|
||||||
TEST_POSIX_CHECKS = \
|
TEST_POSIX_CHECKS = \
|
||||||
$(TEST_POSIX_SRCS_TEST:%.c=o/$(MODE)/%.com.runs)
|
$(TEST_POSIX_SRCS_TEST:%.c=o/$(MODE)/%.runs)
|
||||||
|
|
||||||
TEST_POSIX_DIRECTDEPS = \
|
TEST_POSIX_DIRECTDEPS = \
|
||||||
LIBC_CALLS \
|
LIBC_CALLS \
|
||||||
|
@ -43,7 +43,7 @@ o/$(MODE)/test/posix/posix.pkg: \
|
||||||
$(TEST_POSIX_OBJS) \
|
$(TEST_POSIX_OBJS) \
|
||||||
$(foreach x,$(TEST_POSIX_DIRECTDEPS),$($(x)_A).pkg)
|
$(foreach x,$(TEST_POSIX_DIRECTDEPS),$($(x)_A).pkg)
|
||||||
|
|
||||||
o/$(MODE)/test/posix/%.com.dbg: \
|
o/$(MODE)/test/posix/%.dbg: \
|
||||||
$(TEST_POSIX_DEPS) \
|
$(TEST_POSIX_DEPS) \
|
||||||
o/$(MODE)/test/posix/%.o \
|
o/$(MODE)/test/posix/%.o \
|
||||||
o/$(MODE)/test/posix/posix.pkg \
|
o/$(MODE)/test/posix/posix.pkg \
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
// clang-format off
|
// clang-format off
|
||||||
// sh -c 'build/bootstrap/make.com -j8 V=1 o//test/posix/sigchld_test.com.runs'
|
// sh -c 'build/bootstrap/make -j8 V=1 o//test/posix/sigchld_test.runs'
|
||||||
// clang-format on
|
// clang-format on
|
||||||
|
|
||||||
void Assert(const char *file, int line, bool ok) {
|
void Assert(const char *file, int line, bool ok) {
|
||||||
|
|
|
@ -9,24 +9,24 @@ TEST_TOOL_ARGS_FILES := $(wildcard test/tool/args/*)
|
||||||
TEST_TOOL_ARGS_SRCS = $(filter %.c,$(TEST_TOOL_ARGS_FILES))
|
TEST_TOOL_ARGS_SRCS = $(filter %.c,$(TEST_TOOL_ARGS_FILES))
|
||||||
TEST_TOOL_ARGS_SRCS_TEST = $(filter %_test.c,$(TEST_TOOL_ARGS_SRCS))
|
TEST_TOOL_ARGS_SRCS_TEST = $(filter %_test.c,$(TEST_TOOL_ARGS_SRCS))
|
||||||
TEST_TOOL_ARGS_HDRS = $(filter %.h,$(TEST_TOOL_ARGS_FILES))
|
TEST_TOOL_ARGS_HDRS = $(filter %.h,$(TEST_TOOL_ARGS_FILES))
|
||||||
TEST_TOOL_ARGS_COMS = $(TEST_TOOL_ARGS_OBJS:%.o=%.com)
|
TEST_TOOL_ARGS_COMS = $(TEST_TOOL_ARGS_OBJS:%.o=%)
|
||||||
|
|
||||||
TEST_TOOL_ARGS_OBJS = \
|
TEST_TOOL_ARGS_OBJS = \
|
||||||
$(TEST_TOOL_ARGS_SRCS:%.c=o/$(MODE)/%.o)
|
$(TEST_TOOL_ARGS_SRCS:%.c=o/$(MODE)/%.o)
|
||||||
|
|
||||||
TEST_TOOL_ARGS_COMS = \
|
TEST_TOOL_ARGS_COMS = \
|
||||||
$(TEST_TOOL_ARGS_SRCS:%.c=o/$(MODE)/%.com)
|
$(TEST_TOOL_ARGS_SRCS:%.c=o/$(MODE)/%)
|
||||||
|
|
||||||
TEST_TOOL_ARGS_BINS = \
|
TEST_TOOL_ARGS_BINS = \
|
||||||
$(TEST_TOOL_ARGS_COMS) \
|
$(TEST_TOOL_ARGS_COMS) \
|
||||||
$(TEST_TOOL_ARGS_COMS:%=%.dbg)
|
$(TEST_TOOL_ARGS_COMS:%=%.dbg)
|
||||||
|
|
||||||
TEST_TOOL_ARGS_TESTS = \
|
TEST_TOOL_ARGS_TESTS = \
|
||||||
$(TEST_TOOL_ARGS_SRCS_TEST:%.c=o/$(MODE)/%.com.ok)
|
$(TEST_TOOL_ARGS_SRCS_TEST:%.c=o/$(MODE)/%.ok)
|
||||||
|
|
||||||
TEST_TOOL_ARGS_CHECKS = \
|
TEST_TOOL_ARGS_CHECKS = \
|
||||||
$(TEST_TOOL_ARGS_HDRS:%=o/$(MODE)/%.ok) \
|
$(TEST_TOOL_ARGS_HDRS:%=o/$(MODE)/%.ok) \
|
||||||
$(TEST_TOOL_ARGS_SRCS_TEST:%.c=o/$(MODE)/%.com.runs)
|
$(TEST_TOOL_ARGS_SRCS_TEST:%.c=o/$(MODE)/%.runs)
|
||||||
|
|
||||||
TEST_TOOL_ARGS_DIRECTDEPS = \
|
TEST_TOOL_ARGS_DIRECTDEPS = \
|
||||||
LIBC_CALLS \
|
LIBC_CALLS \
|
||||||
|
@ -56,7 +56,7 @@ $(TEST_TOOL_ARGS_A).pkg: \
|
||||||
$(TEST_TOOL_ARGS_OBJS) \
|
$(TEST_TOOL_ARGS_OBJS) \
|
||||||
$(foreach x,$(TEST_TOOL_ARGS_DIRECTDEPS),$($(x)_A).pkg)
|
$(foreach x,$(TEST_TOOL_ARGS_DIRECTDEPS),$($(x)_A).pkg)
|
||||||
|
|
||||||
o/$(MODE)/test/tool/args/%.com.dbg: \
|
o/$(MODE)/test/tool/args/%.dbg: \
|
||||||
$(TEST_TOOL_ARGS_DEPS) \
|
$(TEST_TOOL_ARGS_DEPS) \
|
||||||
$(TEST_TOOL_ARGS_A) \
|
$(TEST_TOOL_ARGS_A) \
|
||||||
o/$(MODE)/test/tool/args/%.o \
|
o/$(MODE)/test/tool/args/%.o \
|
||||||
|
|
|
@ -9,24 +9,24 @@ TEST_TOOL_BUILD_LIB_FILES := $(wildcard test/tool/build/lib/*)
|
||||||
TEST_TOOL_BUILD_LIB_SRCS = $(filter %.c,$(TEST_TOOL_BUILD_LIB_FILES))
|
TEST_TOOL_BUILD_LIB_SRCS = $(filter %.c,$(TEST_TOOL_BUILD_LIB_FILES))
|
||||||
TEST_TOOL_BUILD_LIB_SRCS_TEST = $(filter %_test.c,$(TEST_TOOL_BUILD_LIB_SRCS))
|
TEST_TOOL_BUILD_LIB_SRCS_TEST = $(filter %_test.c,$(TEST_TOOL_BUILD_LIB_SRCS))
|
||||||
TEST_TOOL_BUILD_LIB_HDRS = $(filter %.h,$(TEST_TOOL_BUILD_LIB_FILES))
|
TEST_TOOL_BUILD_LIB_HDRS = $(filter %.h,$(TEST_TOOL_BUILD_LIB_FILES))
|
||||||
TEST_TOOL_BUILD_LIB_COMS = $(TEST_TOOL_BUILD_LIB_OBJS:%.o=%.com)
|
TEST_TOOL_BUILD_LIB_COMS = $(TEST_TOOL_BUILD_LIB_OBJS:%.o=%)
|
||||||
|
|
||||||
TEST_TOOL_BUILD_LIB_OBJS = \
|
TEST_TOOL_BUILD_LIB_OBJS = \
|
||||||
$(TEST_TOOL_BUILD_LIB_SRCS:%.c=o/$(MODE)/%.o)
|
$(TEST_TOOL_BUILD_LIB_SRCS:%.c=o/$(MODE)/%.o)
|
||||||
|
|
||||||
TEST_TOOL_BUILD_LIB_COMS = \
|
TEST_TOOL_BUILD_LIB_COMS = \
|
||||||
$(TEST_TOOL_BUILD_LIB_SRCS:%.c=o/$(MODE)/%.com)
|
$(TEST_TOOL_BUILD_LIB_SRCS:%.c=o/$(MODE)/%)
|
||||||
|
|
||||||
TEST_TOOL_BUILD_LIB_BINS = \
|
TEST_TOOL_BUILD_LIB_BINS = \
|
||||||
$(TEST_TOOL_BUILD_LIB_COMS) \
|
$(TEST_TOOL_BUILD_LIB_COMS) \
|
||||||
$(TEST_TOOL_BUILD_LIB_COMS:%=%.dbg)
|
$(TEST_TOOL_BUILD_LIB_COMS:%=%.dbg)
|
||||||
|
|
||||||
TEST_TOOL_BUILD_LIB_TESTS = \
|
TEST_TOOL_BUILD_LIB_TESTS = \
|
||||||
$(TEST_TOOL_BUILD_LIB_SRCS_TEST:%.c=o/$(MODE)/%.com.ok)
|
$(TEST_TOOL_BUILD_LIB_SRCS_TEST:%.c=o/$(MODE)/%.ok)
|
||||||
|
|
||||||
TEST_TOOL_BUILD_LIB_CHECKS = \
|
TEST_TOOL_BUILD_LIB_CHECKS = \
|
||||||
$(TEST_TOOL_BUILD_LIB_HDRS:%=o/$(MODE)/%.ok) \
|
$(TEST_TOOL_BUILD_LIB_HDRS:%=o/$(MODE)/%.ok) \
|
||||||
$(TEST_TOOL_BUILD_LIB_SRCS_TEST:%.c=o/$(MODE)/%.com.runs)
|
$(TEST_TOOL_BUILD_LIB_SRCS_TEST:%.c=o/$(MODE)/%.runs)
|
||||||
|
|
||||||
TEST_TOOL_BUILD_LIB_DIRECTDEPS = \
|
TEST_TOOL_BUILD_LIB_DIRECTDEPS = \
|
||||||
LIBC_CALLS \
|
LIBC_CALLS \
|
||||||
|
@ -57,7 +57,7 @@ $(TEST_TOOL_BUILD_LIB_A).pkg: \
|
||||||
$(TEST_TOOL_BUILD_LIB_OBJS) \
|
$(TEST_TOOL_BUILD_LIB_OBJS) \
|
||||||
$(foreach x,$(TEST_TOOL_BUILD_LIB_DIRECTDEPS),$($(x)_A).pkg)
|
$(foreach x,$(TEST_TOOL_BUILD_LIB_DIRECTDEPS),$($(x)_A).pkg)
|
||||||
|
|
||||||
o/$(MODE)/test/tool/build/lib/%.com.dbg: \
|
o/$(MODE)/test/tool/build/lib/%.dbg: \
|
||||||
$(TEST_TOOL_BUILD_LIB_DEPS) \
|
$(TEST_TOOL_BUILD_LIB_DEPS) \
|
||||||
$(TEST_TOOL_BUILD_LIB_A) \
|
$(TEST_TOOL_BUILD_LIB_A) \
|
||||||
o/$(MODE)/test/tool/build/lib/%.o \
|
o/$(MODE)/test/tool/build/lib/%.o \
|
||||||
|
|
|
@ -5,21 +5,21 @@ t=/tmp/pledge-test
|
||||||
if [ $# = 0 ]; then
|
if [ $# = 0 ]; then
|
||||||
if ! [ $(id -u) = 0 ]; then
|
if ! [ $(id -u) = 0 ]; then
|
||||||
make -j16 MODE=fastbuild \
|
make -j16 MODE=fastbuild \
|
||||||
o/fastbuild/examples/ls.com \
|
o/fastbuild/examples/ls \
|
||||||
o/fastbuild/tool/curl/curl.com \
|
o/fastbuild/tool/curl/curl \
|
||||||
o/fastbuild/examples/life.com \
|
o/fastbuild/examples/life \
|
||||||
o/fastbuild/examples/hello.com \
|
o/fastbuild/examples/hello \
|
||||||
o/fastbuild/examples/printargs.com \
|
o/fastbuild/examples/printargs \
|
||||||
o/fastbuild/tool/build/assimilate.com \
|
o/fastbuild/tool/build/assimilate \
|
||||||
o/fastbuild/tool/build/pledge.com || exit
|
o/fastbuild/tool/build/pledge || exit
|
||||||
make -j16 MODE=$m \
|
make -j16 MODE=$m \
|
||||||
o/$m/examples/ls.com \
|
o/$m/examples/ls \
|
||||||
o/$m/tool/curl/curl.com \
|
o/$m/tool/curl/curl \
|
||||||
o/$m/examples/life.com \
|
o/$m/examples/life \
|
||||||
o/$m/examples/hello.com \
|
o/$m/examples/hello \
|
||||||
o/$m/examples/printargs.com \
|
o/$m/examples/printargs \
|
||||||
o/$m/tool/build/assimilate.com \
|
o/$m/tool/build/assimilate \
|
||||||
o/$m/tool/build/pledge.com || exit
|
o/$m/tool/build/pledge || exit
|
||||||
test/tool/build/pledge_test.sh ape_binfmt_test_suite || exit
|
test/tool/build/pledge_test.sh ape_binfmt_test_suite || exit
|
||||||
test/tool/build/pledge_test.sh ape_loader_test_suite || exit
|
test/tool/build/pledge_test.sh ape_loader_test_suite || exit
|
||||||
test/tool/build/pledge_test.sh ape_assimilated_test_suite || exit
|
test/tool/build/pledge_test.sh ape_assimilated_test_suite || exit
|
||||||
|
@ -59,41 +59,41 @@ if [ "$1" = setuid_setup ]; then
|
||||||
rm -rf $t || exit
|
rm -rf $t || exit
|
||||||
mkdir -p $t || exit
|
mkdir -p $t || exit
|
||||||
chmod 01777 $t || exit
|
chmod 01777 $t || exit
|
||||||
cp o/$m/tool/build/pledge.com $t || exit
|
cp o/$m/tool/build/pledge $t || exit
|
||||||
chmod 06755 $t/pledge.com || exit
|
chmod 06755 $t/pledge || exit
|
||||||
|
|
||||||
elif [ "$1" = ape_binfmt_test_suite ]; then
|
elif [ "$1" = ape_binfmt_test_suite ]; then
|
||||||
|
|
||||||
ape/apeinstall.sh >/dev/null 2>&1
|
ape/apeinstall.sh >/dev/null 2>&1
|
||||||
|
|
||||||
startit ape binfmt life.com
|
startit ape binfmt life
|
||||||
o/fastbuild/tool/build/pledge.com -p 'stdio rpath prot_exec' o/fastbuild/examples/life.com
|
o/fastbuild/tool/build/pledge -p 'stdio rpath prot_exec' o/fastbuild/examples/life
|
||||||
[ $? = 42 ]
|
[ $? = 42 ]
|
||||||
checkem
|
checkem
|
||||||
|
|
||||||
startit ape binfmt hello.com
|
startit ape binfmt hello
|
||||||
[ "$(o/fastbuild/tool/build/pledge.com -p 'stdio rpath prot_exec' o/fastbuild/examples/hello.com)" = "hello world" ]
|
[ "$(o/fastbuild/tool/build/pledge -p 'stdio rpath prot_exec' o/fastbuild/examples/hello)" = "hello world" ]
|
||||||
checkem
|
checkem
|
||||||
|
|
||||||
startit ape binfmt curl.com
|
startit ape binfmt curl
|
||||||
[ "$(o/fastbuild/tool/build/pledge.com -p 'stdio inet dns rpath prot_exec' o/fastbuild/tool/curl/curl.com https://justine.lol/hello.txt)" = "hello world" ]
|
[ "$(o/fastbuild/tool/build/pledge -p 'stdio inet dns rpath prot_exec' o/fastbuild/tool/curl/curl https://justine.lol/hello.txt)" = "hello world" ]
|
||||||
checkem
|
checkem
|
||||||
|
|
||||||
elif [ "$1" = ape_loader_test_suite ]; then
|
elif [ "$1" = ape_loader_test_suite ]; then
|
||||||
|
|
||||||
ape/apeuninstall.sh >/dev/null 2>&1
|
ape/apeuninstall.sh >/dev/null 2>&1
|
||||||
|
|
||||||
startit ape loader life.com
|
startit ape loader life
|
||||||
o/fastbuild/tool/build/pledge.com -p 'stdio rpath prot_exec' o/fastbuild/examples/life.com
|
o/fastbuild/tool/build/pledge -p 'stdio rpath prot_exec' o/fastbuild/examples/life
|
||||||
[ $? = 42 ]
|
[ $? = 42 ]
|
||||||
checkem
|
checkem
|
||||||
|
|
||||||
startit ape loader hello.com
|
startit ape loader hello
|
||||||
[ "$(o/fastbuild/tool/build/pledge.com -p 'stdio rpath prot_exec' o/fastbuild/examples/hello.com)" = "hello world" ]
|
[ "$(o/fastbuild/tool/build/pledge -p 'stdio rpath prot_exec' o/fastbuild/examples/hello)" = "hello world" ]
|
||||||
checkem
|
checkem
|
||||||
|
|
||||||
startit ape loader curl.com
|
startit ape loader curl
|
||||||
[ "$(o/fastbuild/tool/build/pledge.com -p 'stdio inet dns rpath prot_exec' o/fastbuild/tool/curl/curl.com https://justine.lol/hello.txt)" = "hello world" ]
|
[ "$(o/fastbuild/tool/build/pledge -p 'stdio inet dns rpath prot_exec' o/fastbuild/tool/curl/curl https://justine.lol/hello.txt)" = "hello world" ]
|
||||||
checkem
|
checkem
|
||||||
|
|
||||||
ape/apeinstall.sh >/dev/null 2>&1
|
ape/apeinstall.sh >/dev/null 2>&1
|
||||||
|
@ -102,76 +102,76 @@ elif [ "$1" = ape_assimilated_test_suite ]; then
|
||||||
|
|
||||||
mkdir -p $t/assimilated
|
mkdir -p $t/assimilated
|
||||||
|
|
||||||
startit ape assimilated life.com
|
startit ape assimilated life
|
||||||
cp o/fastbuild/examples/life.com $t/assimilated
|
cp o/fastbuild/examples/life $t/assimilated
|
||||||
o/fastbuild/tool/build/assimilate.com $t/assimilated/life.com
|
o/fastbuild/tool/build/assimilate $t/assimilated/life
|
||||||
o/$m/tool/build/pledge.com -p 'stdio' $t/assimilated/life.com
|
o/$m/tool/build/pledge -p 'stdio' $t/assimilated/life
|
||||||
[ $? = 42 ]
|
[ $? = 42 ]
|
||||||
checkem
|
checkem
|
||||||
|
|
||||||
startit ape assimilated hello.com
|
startit ape assimilated hello
|
||||||
cp o/fastbuild/examples/hello.com $t/assimilated
|
cp o/fastbuild/examples/hello $t/assimilated
|
||||||
o/fastbuild/tool/build/assimilate.com $t/assimilated/hello.com
|
o/fastbuild/tool/build/assimilate $t/assimilated/hello
|
||||||
[ "$(o/$m/tool/build/pledge.com -p 'stdio' $t/assimilated/hello.com)" = "hello world" ]
|
[ "$(o/$m/tool/build/pledge -p 'stdio' $t/assimilated/hello)" = "hello world" ]
|
||||||
checkem
|
checkem
|
||||||
|
|
||||||
startit ape assimilated curl.com
|
startit ape assimilated curl
|
||||||
cp o/fastbuild/tool/curl/curl.com $t/assimilated
|
cp o/fastbuild/tool/curl/curl $t/assimilated
|
||||||
o/fastbuild/tool/build/assimilate.com $t/assimilated/curl.com
|
o/fastbuild/tool/build/assimilate $t/assimilated/curl
|
||||||
[ "$(o/$m/tool/build/pledge.com -p 'stdio rpath inet dns' $t/assimilated/curl.com https://justine.lol/hello.txt)" = "hello world" ]
|
[ "$(o/$m/tool/build/pledge -p 'stdio rpath inet dns' $t/assimilated/curl https://justine.lol/hello.txt)" = "hello world" ]
|
||||||
checkem
|
checkem
|
||||||
|
|
||||||
elif [ "$1" = ape_native_test_suite ]; then
|
elif [ "$1" = ape_native_test_suite ]; then
|
||||||
|
|
||||||
startit ape native life.com
|
startit ape native life
|
||||||
o/$m/tool/build/pledge.com -p 'stdio' o/$m/examples/life.com
|
o/$m/tool/build/pledge -p 'stdio' o/$m/examples/life
|
||||||
[ $? = 42 ]
|
[ $? = 42 ]
|
||||||
checkem
|
checkem
|
||||||
|
|
||||||
startit ape native hello.com
|
startit ape native hello
|
||||||
[ "$(o/$m/tool/build/pledge.com -p 'stdio' o/$m/examples/hello.com)" = "hello world" ]
|
[ "$(o/$m/tool/build/pledge -p 'stdio' o/$m/examples/hello)" = "hello world" ]
|
||||||
checkem
|
checkem
|
||||||
|
|
||||||
startit ape native curl.com
|
startit ape native curl
|
||||||
[ "$(o/$m/tool/build/pledge.com -p 'stdio rpath inet dns' o/$m/tool/curl/curl.com https://justine.lol/hello.txt)" = "hello world" ]
|
[ "$(o/$m/tool/build/pledge -p 'stdio rpath inet dns' o/$m/tool/curl/curl https://justine.lol/hello.txt)" = "hello world" ]
|
||||||
checkem
|
checkem
|
||||||
|
|
||||||
elif [ "$1" = setuid_test_suite ]; then
|
elif [ "$1" = setuid_test_suite ]; then
|
||||||
|
|
||||||
startit setuid life.com
|
startit setuid life
|
||||||
$t/pledge.com -p 'stdio' o/$m/examples/life.com
|
$t/pledge -p 'stdio' o/$m/examples/life
|
||||||
[ $? = 42 ]
|
[ $? = 42 ]
|
||||||
checkem
|
checkem
|
||||||
|
|
||||||
startit setuid hello.com
|
startit setuid hello
|
||||||
[ "$($t/pledge.com -p 'stdio' o/$m/examples/hello.com)" = "hello world" ]
|
[ "$($t/pledge -p 'stdio' o/$m/examples/hello)" = "hello world" ]
|
||||||
checkem
|
checkem
|
||||||
|
|
||||||
startit setuid curl.com
|
startit setuid curl
|
||||||
[ "$($t/pledge.com -p 'stdio rpath inet dns' o/$m/tool/curl/curl.com https://justine.lol/hello.txt)" = "hello world" ]
|
[ "$($t/pledge -p 'stdio rpath inet dns' o/$m/tool/curl/curl https://justine.lol/hello.txt)" = "hello world" ]
|
||||||
checkem
|
checkem
|
||||||
|
|
||||||
startit setuid getuid
|
startit setuid getuid
|
||||||
[ "$($t/pledge.com -p 'stdio rpath proc tty' o/$m/examples/printargs.com 2>&1 | grep getuid | grep -o [[:digit:]]*)" = "$(id -u)" ]
|
[ "$($t/pledge -p 'stdio rpath proc tty' o/$m/examples/printargs 2>&1 | grep getuid | grep -o [[:digit:]]*)" = "$(id -u)" ]
|
||||||
checkem
|
checkem
|
||||||
|
|
||||||
startit setuid geteuid
|
startit setuid geteuid
|
||||||
[ "$($t/pledge.com -p 'stdio rpath proc tty' o/$m/examples/printargs.com 2>&1 | grep geteuid | grep -o [[:digit:]]*)" = "$(id -u)" ]
|
[ "$($t/pledge -p 'stdio rpath proc tty' o/$m/examples/printargs 2>&1 | grep geteuid | grep -o [[:digit:]]*)" = "$(id -u)" ]
|
||||||
checkem
|
checkem
|
||||||
|
|
||||||
startit setuid no capabilities
|
startit setuid no capabilities
|
||||||
[ "$($t/pledge.com -p 'stdio rpath proc tty' o/$m/examples/printargs.com 2>&1 | grep CAP_ | wc -l)" = 0 ]
|
[ "$($t/pledge -p 'stdio rpath proc tty' o/$m/examples/printargs 2>&1 | grep CAP_ | wc -l)" = 0 ]
|
||||||
checkem
|
checkem
|
||||||
|
|
||||||
startit setuid maximum nice
|
startit setuid maximum nice
|
||||||
$t/pledge.com -np 'stdio rpath proc tty' o/$m/examples/printargs.com 2>&1 | grep SCHED_IDLE >/dev/null
|
$t/pledge -np 'stdio rpath proc tty' o/$m/examples/printargs 2>&1 | grep SCHED_IDLE >/dev/null
|
||||||
checkem
|
checkem
|
||||||
|
|
||||||
startit setuid chroot
|
startit setuid chroot
|
||||||
mkdir $t/jail &&
|
mkdir $t/jail &&
|
||||||
touch $t/jail/hi &&
|
touch $t/jail/hi &&
|
||||||
cp o/$m/examples/ls.com $t/jail &&
|
cp o/$m/examples/ls $t/jail &&
|
||||||
$t/pledge.com -v / -c $t/jail -p 'stdio rpath' /ls.com / | grep 'DT_REG /hi' >/dev/null
|
$t/pledge -v / -c $t/jail -p 'stdio rpath' /ls / | grep 'DT_REG /hi' >/dev/null
|
||||||
checkem
|
checkem
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -10,22 +10,22 @@ TEST_TOOL_NET_SRCS = $(filter %.c,$(TEST_TOOL_NET_FILES))
|
||||||
TEST_TOOL_NET_SRCS_TEST = $(filter %_test.c,$(TEST_TOOL_NET_SRCS))
|
TEST_TOOL_NET_SRCS_TEST = $(filter %_test.c,$(TEST_TOOL_NET_SRCS))
|
||||||
TEST_TOOL_NET_LUAS_TEST = $(filter %_test.lua,$(TEST_TOOL_NET_FILES))
|
TEST_TOOL_NET_LUAS_TEST = $(filter %_test.lua,$(TEST_TOOL_NET_FILES))
|
||||||
TEST_TOOL_NET_HDRS = $(filter %.h,$(TEST_TOOL_NET_FILES))
|
TEST_TOOL_NET_HDRS = $(filter %.h,$(TEST_TOOL_NET_FILES))
|
||||||
TEST_TOOL_NET_COMS = $(TEST_TOOL_NET_SRCS:%.c=o/$(MODE)/%.com)
|
TEST_TOOL_NET_COMS = $(TEST_TOOL_NET_SRCS:%.c=o/$(MODE)/%)
|
||||||
|
|
||||||
TEST_TOOL_NET_OBJS = \
|
TEST_TOOL_NET_OBJS = \
|
||||||
$(TEST_TOOL_NET_SRCS:%.c=o/$(MODE)/%.o) \
|
$(TEST_TOOL_NET_SRCS:%.c=o/$(MODE)/%.o) \
|
||||||
o/$(MODE)/test/tool/net/redbean-tester.com.zip.o
|
o/$(MODE)/test/tool/net/redbean-tester.zip.o
|
||||||
|
|
||||||
TEST_TOOL_NET_BINS = \
|
TEST_TOOL_NET_BINS = \
|
||||||
$(TEST_TOOL_NET_COMS) \
|
$(TEST_TOOL_NET_COMS) \
|
||||||
$(TEST_TOOL_NET_COMS:%=%.dbg)
|
$(TEST_TOOL_NET_COMS:%=%.dbg)
|
||||||
|
|
||||||
TEST_TOOL_NET_TESTS = \
|
TEST_TOOL_NET_TESTS = \
|
||||||
$(TEST_TOOL_NET_SRCS_TEST:%.c=o/$(MODE)/%.com.ok)
|
$(TEST_TOOL_NET_SRCS_TEST:%.c=o/$(MODE)/%.ok)
|
||||||
|
|
||||||
TEST_TOOL_NET_CHECKS = \
|
TEST_TOOL_NET_CHECKS = \
|
||||||
$(TEST_TOOL_NET_HDRS:%=o/$(MODE)/%.ok) \
|
$(TEST_TOOL_NET_HDRS:%=o/$(MODE)/%.ok) \
|
||||||
$(TEST_TOOL_NET_SRCS_TEST:%.c=o/$(MODE)/%.com.runs) \
|
$(TEST_TOOL_NET_SRCS_TEST:%.c=o/$(MODE)/%.runs) \
|
||||||
$(TEST_TOOL_NET_LUAS_TEST:%.lua=o/$(MODE)/%.lua.runs)
|
$(TEST_TOOL_NET_LUAS_TEST:%.lua=o/$(MODE)/%.lua.runs)
|
||||||
|
|
||||||
TEST_TOOL_NET_DIRECTDEPS = \
|
TEST_TOOL_NET_DIRECTDEPS = \
|
||||||
|
@ -60,7 +60,7 @@ $(TEST_TOOL_NET_A).pkg: \
|
||||||
$(TEST_TOOL_NET_OBJS) \
|
$(TEST_TOOL_NET_OBJS) \
|
||||||
$(foreach x,$(TEST_TOOL_NET_DIRECTDEPS),$($(x)_A).pkg)
|
$(foreach x,$(TEST_TOOL_NET_DIRECTDEPS),$($(x)_A).pkg)
|
||||||
|
|
||||||
o/$(MODE)/test/tool/net/%.com.dbg: \
|
o/$(MODE)/test/tool/net/%.dbg: \
|
||||||
$(TEST_TOOL_NET_DEPS) \
|
$(TEST_TOOL_NET_DEPS) \
|
||||||
$(TEST_TOOL_NET_A) \
|
$(TEST_TOOL_NET_A) \
|
||||||
o/$(MODE)/test/tool/net/%.o \
|
o/$(MODE)/test/tool/net/%.o \
|
||||||
|
@ -70,7 +70,8 @@ o/$(MODE)/test/tool/net/%.com.dbg: \
|
||||||
$(APE_NO_MODIFY_SELF)
|
$(APE_NO_MODIFY_SELF)
|
||||||
@$(APELINK)
|
@$(APELINK)
|
||||||
|
|
||||||
o/$(MODE)/test/tool/net/redbean-tester.com.dbg: \
|
.PRECIOUS: o/$(MODE)/test/tool/net/redbean-tester
|
||||||
|
o/$(MODE)/test/tool/net/redbean-tester.dbg: \
|
||||||
$(TOOL_NET_DEPS) \
|
$(TOOL_NET_DEPS) \
|
||||||
o/$(MODE)/tool/net/redbean.o \
|
o/$(MODE)/tool/net/redbean.o \
|
||||||
$(TOOL_NET_REDBEAN_LUA_MODULES) \
|
$(TOOL_NET_REDBEAN_LUA_MODULES) \
|
||||||
|
@ -80,20 +81,10 @@ o/$(MODE)/test/tool/net/redbean-tester.com.dbg: \
|
||||||
$(APE_NO_MODIFY_SELF)
|
$(APE_NO_MODIFY_SELF)
|
||||||
@$(APELINK)
|
@$(APELINK)
|
||||||
|
|
||||||
o/$(MODE)/test/tool/net/redbean-tester.com: \
|
o/$(MODE)/test/tool/net/redbean_test.runs: \
|
||||||
o/$(MODE)/test/tool/net/redbean-tester.com.dbg \
|
|
||||||
o/$(MODE)/third_party/zip/zip.com \
|
|
||||||
o/$(MODE)/tool/build/symtab.com \
|
|
||||||
$(TOOL_NET_REDBEAN_STANDARD_ASSETS)
|
|
||||||
@$(MAKE_OBJCOPY)
|
|
||||||
@$(MAKE_SYMTAB_CREATE)
|
|
||||||
@$(MAKE_SYMTAB_ZIP)
|
|
||||||
@$(TOOL_NET_REDBEAN_STANDARD_ASSETS_ZIP)
|
|
||||||
|
|
||||||
o/$(MODE)/test/tool/net/redbean_test.com.runs: \
|
|
||||||
private .PLEDGE = stdio rpath wpath cpath fattr proc inet
|
private .PLEDGE = stdio rpath wpath cpath fattr proc inet
|
||||||
|
|
||||||
o/$(MODE)/test/tool/net/sqlite_test.com.runs: \
|
o/$(MODE)/test/tool/net/sqlite_test.runs: \
|
||||||
private .PLEDGE = stdio rpath wpath cpath fattr proc flock
|
private .PLEDGE = stdio rpath wpath cpath fattr proc flock
|
||||||
|
|
||||||
.PHONY: o/$(MODE)/test/tool/net
|
.PHONY: o/$(MODE)/test/tool/net
|
||||||
|
|
|
@ -42,7 +42,7 @@
|
||||||
#ifdef __x86_64__
|
#ifdef __x86_64__
|
||||||
|
|
||||||
__static_yoink("zipos");
|
__static_yoink("zipos");
|
||||||
__static_yoink("o/" MODE "/test/tool/net/redbean-tester.com");
|
__static_yoink("o/" MODE "/test/tool/net/redbean-tester");
|
||||||
|
|
||||||
int port;
|
int port;
|
||||||
|
|
||||||
|
@ -53,9 +53,9 @@ void SetUpOnce(void) {
|
||||||
if (IsWindows()) return;
|
if (IsWindows()) return;
|
||||||
testlib_enable_tmp_setup_teardown_once();
|
testlib_enable_tmp_setup_teardown_once();
|
||||||
ASSERT_NE(-1, mkdir("bin", 0755));
|
ASSERT_NE(-1, mkdir("bin", 0755));
|
||||||
ASSERT_NE(-1, (fdin = open("/zip/o/" MODE "/test/tool/net/redbean-tester.com",
|
ASSERT_NE(-1, (fdin = open("/zip/o/" MODE "/test/tool/net/redbean-tester",
|
||||||
O_RDONLY)));
|
O_RDONLY)));
|
||||||
ASSERT_NE(-1, (fdout = creat("bin/redbean-tester.com", 0755)));
|
ASSERT_NE(-1, (fdout = creat("bin/redbean-tester", 0755)));
|
||||||
for (;;) {
|
for (;;) {
|
||||||
ASSERT_NE(-1, (n = read(fdin, buf, sizeof(buf))));
|
ASSERT_NE(-1, (n = read(fdin, buf, sizeof(buf))));
|
||||||
if (!n) break;
|
if (!n) break;
|
||||||
|
@ -118,8 +118,8 @@ TEST(redbean, testOptions) {
|
||||||
close(pipefds[0]);
|
close(pipefds[0]);
|
||||||
dup2(pipefds[1], 1);
|
dup2(pipefds[1], 1);
|
||||||
sigprocmask(SIG_SETMASK, &savemask, NULL);
|
sigprocmask(SIG_SETMASK, &savemask, NULL);
|
||||||
execv("bin/redbean-tester.com",
|
execv("bin/redbean-tester",
|
||||||
(char *const[]){"bin/redbean-tester.com", "-vvszXp0", "-l127.0.0.1",
|
(char *const[]){"bin/redbean-tester", "-vvszXp0", "-l127.0.0.1",
|
||||||
__strace > 0 ? "--strace" : 0, 0});
|
__strace > 0 ? "--strace" : 0, 0});
|
||||||
_exit(127);
|
_exit(127);
|
||||||
}
|
}
|
||||||
|
@ -157,8 +157,8 @@ TEST(redbean, testPipeline) {
|
||||||
close(pipefds[0]);
|
close(pipefds[0]);
|
||||||
dup2(pipefds[1], 1);
|
dup2(pipefds[1], 1);
|
||||||
sigprocmask(SIG_SETMASK, &savemask, NULL);
|
sigprocmask(SIG_SETMASK, &savemask, NULL);
|
||||||
execv("bin/redbean-tester.com",
|
execv("bin/redbean-tester",
|
||||||
(char *const[]){"bin/redbean-tester.com", "-vvszXp0", "-l127.0.0.1",
|
(char *const[]){"bin/redbean-tester", "-vvszXp0", "-l127.0.0.1",
|
||||||
__strace > 0 ? "--strace" : 0, 0});
|
__strace > 0 ? "--strace" : 0, 0});
|
||||||
_exit(127);
|
_exit(127);
|
||||||
}
|
}
|
||||||
|
@ -205,8 +205,8 @@ TEST(redbean, testContentRange) {
|
||||||
close(pipefds[0]);
|
close(pipefds[0]);
|
||||||
dup2(pipefds[1], 1);
|
dup2(pipefds[1], 1);
|
||||||
sigprocmask(SIG_SETMASK, &savemask, NULL);
|
sigprocmask(SIG_SETMASK, &savemask, NULL);
|
||||||
execv("bin/redbean-tester.com",
|
execv("bin/redbean-tester",
|
||||||
(char *const[]){"bin/redbean-tester.com", "-vvszXp0", "-l127.0.0.1",
|
(char *const[]){"bin/redbean-tester", "-vvszXp0", "-l127.0.0.1",
|
||||||
__strace > 0 ? "--strace" : 0, 0});
|
__strace > 0 ? "--strace" : 0, 0});
|
||||||
_exit(127);
|
_exit(127);
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,11 +11,11 @@ TEST_TOOL_PLINKO_FILES := $(wildcard test/tool/plinko/*)
|
||||||
TEST_TOOL_PLINKO_SRCS = $(filter %.c,$(TEST_TOOL_PLINKO_FILES))
|
TEST_TOOL_PLINKO_SRCS = $(filter %.c,$(TEST_TOOL_PLINKO_FILES))
|
||||||
TEST_TOOL_PLINKO_SRCS_TEST = $(filter %_test.c,$(TEST_TOOL_PLINKO_SRCS))
|
TEST_TOOL_PLINKO_SRCS_TEST = $(filter %_test.c,$(TEST_TOOL_PLINKO_SRCS))
|
||||||
TEST_TOOL_PLINKO_HDRS = $(filter %.h,$(TEST_TOOL_PLINKO_FILES))
|
TEST_TOOL_PLINKO_HDRS = $(filter %.h,$(TEST_TOOL_PLINKO_FILES))
|
||||||
TEST_TOOL_PLINKO_COMS = $(TEST_TOOL_PLINKO_OBJS:%.o=%.com)
|
TEST_TOOL_PLINKO_COMS = $(TEST_TOOL_PLINKO_OBJS:%.o=%)
|
||||||
|
|
||||||
TEST_TOOL_PLINKO_OBJS = \
|
TEST_TOOL_PLINKO_OBJS = \
|
||||||
$(TEST_TOOL_PLINKO_SRCS:%.c=o/$(MODE)/%.o) \
|
$(TEST_TOOL_PLINKO_SRCS:%.c=o/$(MODE)/%.o) \
|
||||||
o/$(MODE)/tool/plinko/plinko.com.zip.o \
|
o/$(MODE)/tool/plinko/plinko.zip.o \
|
||||||
o/$(MODE)/tool/plinko/lib/library.lisp.zip.o \
|
o/$(MODE)/tool/plinko/lib/library.lisp.zip.o \
|
||||||
o/$(MODE)/tool/plinko/lib/binarytrees.lisp.zip.o \
|
o/$(MODE)/tool/plinko/lib/binarytrees.lisp.zip.o \
|
||||||
o/$(MODE)/tool/plinko/lib/algebra.lisp.zip.o \
|
o/$(MODE)/tool/plinko/lib/algebra.lisp.zip.o \
|
||||||
|
@ -25,18 +25,18 @@ TEST_TOOL_PLINKO_OBJS = \
|
||||||
o/$(MODE)/test/tool/plinko/algebra_test.lisp.zip.o
|
o/$(MODE)/test/tool/plinko/algebra_test.lisp.zip.o
|
||||||
|
|
||||||
TEST_TOOL_PLINKO_COMS = \
|
TEST_TOOL_PLINKO_COMS = \
|
||||||
$(TEST_TOOL_PLINKO_SRCS:%.c=o/$(MODE)/%.com)
|
$(TEST_TOOL_PLINKO_SRCS:%.c=o/$(MODE)/%)
|
||||||
|
|
||||||
TEST_TOOL_PLINKO_BINS = \
|
TEST_TOOL_PLINKO_BINS = \
|
||||||
$(TEST_TOOL_PLINKO_COMS) \
|
$(TEST_TOOL_PLINKO_COMS) \
|
||||||
$(TEST_TOOL_PLINKO_COMS:%=%.dbg)
|
$(TEST_TOOL_PLINKO_COMS:%=%.dbg)
|
||||||
|
|
||||||
TEST_TOOL_PLINKO_TESTS = \
|
TEST_TOOL_PLINKO_TESTS = \
|
||||||
$(TEST_TOOL_PLINKO_SRCS_TEST:%.c=o/$(MODE)/%.com.ok)
|
$(TEST_TOOL_PLINKO_SRCS_TEST:%.c=o/$(MODE)/%.ok)
|
||||||
|
|
||||||
TEST_TOOL_PLINKO_CHECKS = \
|
TEST_TOOL_PLINKO_CHECKS = \
|
||||||
$(TEST_TOOL_PLINKO_HDRS:%=o/$(MODE)/%.ok) \
|
$(TEST_TOOL_PLINKO_HDRS:%=o/$(MODE)/%.ok) \
|
||||||
$(TEST_TOOL_PLINKO_SRCS_TEST:%.c=o/$(MODE)/%.com.runs)
|
$(TEST_TOOL_PLINKO_SRCS_TEST:%.c=o/$(MODE)/%.runs)
|
||||||
|
|
||||||
TEST_TOOL_PLINKO_DIRECTDEPS = \
|
TEST_TOOL_PLINKO_DIRECTDEPS = \
|
||||||
LIBC_CALLS \
|
LIBC_CALLS \
|
||||||
|
@ -67,7 +67,7 @@ $(TEST_TOOL_PLINKO_A).pkg: \
|
||||||
$(TEST_TOOL_PLINKO_OBJS) \
|
$(TEST_TOOL_PLINKO_OBJS) \
|
||||||
$(foreach x,$(TEST_TOOL_PLINKO_DIRECTDEPS),$($(x)_A).pkg)
|
$(foreach x,$(TEST_TOOL_PLINKO_DIRECTDEPS),$($(x)_A).pkg)
|
||||||
|
|
||||||
o/$(MODE)/test/tool/plinko/%.com.dbg: \
|
o/$(MODE)/test/tool/plinko/%.dbg: \
|
||||||
$(TEST_TOOL_PLINKO_DEPS) \
|
$(TEST_TOOL_PLINKO_DEPS) \
|
||||||
$(TEST_TOOL_PLINKO_A) \
|
$(TEST_TOOL_PLINKO_A) \
|
||||||
o/$(MODE)/test/tool/plinko/%.o \
|
o/$(MODE)/test/tool/plinko/%.o \
|
||||||
|
@ -77,7 +77,7 @@ o/$(MODE)/test/tool/plinko/%.com.dbg: \
|
||||||
$(APE_NO_MODIFY_SELF)
|
$(APE_NO_MODIFY_SELF)
|
||||||
@$(APELINK)
|
@$(APELINK)
|
||||||
|
|
||||||
o/$(MODE)/test/tool/plinko/plinko_test.com.runs: private \
|
o/$(MODE)/test/tool/plinko/plinko_test.runs: private \
|
||||||
QUOTA = -M100g
|
QUOTA = -M100g
|
||||||
|
|
||||||
o/$(MODE)/test/tool/plinko/algebra_test.lisp.zip.o: private ZIPOBJ_FLAGS += -B
|
o/$(MODE)/test/tool/plinko/algebra_test.lisp.zip.o: private ZIPOBJ_FLAGS += -B
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
#include "libc/testlib/testlib.h"
|
#include "libc/testlib/testlib.h"
|
||||||
|
|
||||||
__static_yoink("zipos");
|
__static_yoink("zipos");
|
||||||
__static_yoink("plinko.com");
|
__static_yoink("plinko");
|
||||||
__static_yoink("library.lisp");
|
__static_yoink("library.lisp");
|
||||||
__static_yoink("library_test.lisp");
|
__static_yoink("library_test.lisp");
|
||||||
__static_yoink("binarytrees.lisp");
|
__static_yoink("binarytrees.lisp");
|
||||||
|
@ -54,8 +54,8 @@ void SetUpOnce(void) {
|
||||||
int fdin, fdout;
|
int fdin, fdout;
|
||||||
testlib_enable_tmp_setup_teardown_once();
|
testlib_enable_tmp_setup_teardown_once();
|
||||||
ASSERT_NE(-1, mkdir("bin", 0755));
|
ASSERT_NE(-1, mkdir("bin", 0755));
|
||||||
ASSERT_NE(-1, (fdin = open("/zip/plinko.com", O_RDONLY)));
|
ASSERT_NE(-1, (fdin = open("/zip/plinko", O_RDONLY)));
|
||||||
ASSERT_NE(-1, (fdout = creat("bin/plinko.com", 0755)));
|
ASSERT_NE(-1, (fdout = creat("bin/plinko", 0755)));
|
||||||
ASSERT_NE(-1, copyfd(fdin, fdout, -1));
|
ASSERT_NE(-1, copyfd(fdin, fdout, -1));
|
||||||
EXPECT_EQ(0, close(fdout));
|
EXPECT_EQ(0, close(fdout));
|
||||||
EXPECT_EQ(0, close(fdin));
|
EXPECT_EQ(0, close(fdin));
|
||||||
|
@ -89,8 +89,7 @@ TEST(plinko, worksOrPrintsNiceError) {
|
||||||
sigaction(SIGQUIT, &savequit, 0);
|
sigaction(SIGQUIT, &savequit, 0);
|
||||||
sigaction(SIGPIPE, &savepipe, 0);
|
sigaction(SIGPIPE, &savepipe, 0);
|
||||||
sigprocmask(SIG_SETMASK, &savemask, 0);
|
sigprocmask(SIG_SETMASK, &savemask, 0);
|
||||||
execve("bin/plinko.com", (char *const[]){"bin/plinko.com", 0},
|
execve("bin/plinko", (char *const[]){"bin/plinko", 0}, (char *const[]){0});
|
||||||
(char *const[]){0});
|
|
||||||
_exit(127);
|
_exit(127);
|
||||||
}
|
}
|
||||||
close(pfds[0][0]);
|
close(pfds[0][0]);
|
||||||
|
|
|
@ -10,17 +10,17 @@ TEST_TOOL_VIZ_LIB_OBJS = \
|
||||||
$(TEST_TOOL_VIZ_LIB_SRCS:%.c=o/$(MODE)/%.o)
|
$(TEST_TOOL_VIZ_LIB_SRCS:%.c=o/$(MODE)/%.o)
|
||||||
|
|
||||||
TEST_TOOL_VIZ_LIB_COMS = \
|
TEST_TOOL_VIZ_LIB_COMS = \
|
||||||
$(TEST_TOOL_VIZ_LIB_SRCS:%.c=o/$(MODE)/%.com)
|
$(TEST_TOOL_VIZ_LIB_SRCS:%.c=o/$(MODE)/%)
|
||||||
|
|
||||||
TEST_TOOL_VIZ_LIB_BINS = \
|
TEST_TOOL_VIZ_LIB_BINS = \
|
||||||
$(TEST_TOOL_VIZ_LIB_COMS) \
|
$(TEST_TOOL_VIZ_LIB_COMS) \
|
||||||
$(TEST_TOOL_VIZ_LIB_COMS:%=%.dbg)
|
$(TEST_TOOL_VIZ_LIB_COMS:%=%.dbg)
|
||||||
|
|
||||||
TEST_TOOL_VIZ_LIB_TESTS = \
|
TEST_TOOL_VIZ_LIB_TESTS = \
|
||||||
$(TEST_TOOL_VIZ_LIB_SRCS_TEST:%.c=o/$(MODE)/%.com.ok)
|
$(TEST_TOOL_VIZ_LIB_SRCS_TEST:%.c=o/$(MODE)/%.ok)
|
||||||
|
|
||||||
TEST_TOOL_VIZ_LIB_CHECKS = \
|
TEST_TOOL_VIZ_LIB_CHECKS = \
|
||||||
$(TEST_TOOL_VIZ_LIB_SRCS_TEST:%.c=o/$(MODE)/%.com.runs)
|
$(TEST_TOOL_VIZ_LIB_SRCS_TEST:%.c=o/$(MODE)/%.runs)
|
||||||
|
|
||||||
TEST_TOOL_VIZ_LIB_DIRECTDEPS = \
|
TEST_TOOL_VIZ_LIB_DIRECTDEPS = \
|
||||||
DSP_MPEG \
|
DSP_MPEG \
|
||||||
|
@ -45,7 +45,7 @@ o/$(MODE)/test/tool/viz/lib/vizlib.pkg: \
|
||||||
$(TEST_TOOL_VIZ_LIB_OBJS) \
|
$(TEST_TOOL_VIZ_LIB_OBJS) \
|
||||||
$(foreach x,$(TEST_TOOL_VIZ_LIB_DIRECTDEPS),$($(x)_A).pkg)
|
$(foreach x,$(TEST_TOOL_VIZ_LIB_DIRECTDEPS),$($(x)_A).pkg)
|
||||||
|
|
||||||
o/$(MODE)/test/tool/viz/lib/%.com.dbg: \
|
o/$(MODE)/test/tool/viz/lib/%.dbg: \
|
||||||
$(TEST_TOOL_VIZ_LIB_DEPS) \
|
$(TEST_TOOL_VIZ_LIB_DEPS) \
|
||||||
o/$(MODE)/test/tool/viz/lib/%.o \
|
o/$(MODE)/test/tool/viz/lib/%.o \
|
||||||
o/$(MODE)/test/tool/viz/lib/vizlib.pkg \
|
o/$(MODE)/test/tool/viz/lib/vizlib.pkg \
|
||||||
|
|
6
third_party/awk/BUILD.mk
vendored
6
third_party/awk/BUILD.mk
vendored
|
@ -40,10 +40,10 @@ $(THIRD_PARTY_AWK_A): \
|
||||||
$(THIRD_PARTY_AWK_OBJS)
|
$(THIRD_PARTY_AWK_OBJS)
|
||||||
|
|
||||||
$(THIRD_PARTY_AWK_A).pkg: \
|
$(THIRD_PARTY_AWK_A).pkg: \
|
||||||
$(THIRD_PARTY_AWK_OBJS) \
|
$(THIRD_PARTY_AWK_OBJS) \
|
||||||
$(foreach x,$(THIRD_PARTY_AWK_A_DIRECTDEPS),$($(x)_A).pkg)
|
$(foreach x,$(THIRD_PARTY_AWK_A_DIRECTDEPS),$($(x)_A).pkg)
|
||||||
|
|
||||||
o/$(MODE)/third_party/awk/awk.com.dbg: \
|
o/$(MODE)/third_party/awk/awk.dbg: \
|
||||||
$(THIRD_PARTY_AWK) \
|
$(THIRD_PARTY_AWK) \
|
||||||
o/$(MODE)/third_party/awk/cmd.o \
|
o/$(MODE)/third_party/awk/cmd.o \
|
||||||
o/$(MODE)/third_party/awk/README.zip.o \
|
o/$(MODE)/third_party/awk/README.zip.o \
|
||||||
|
@ -56,7 +56,7 @@ o/$(MODE)/third_party/awk/README.zip.o: \
|
||||||
-B
|
-B
|
||||||
|
|
||||||
THIRD_PARTY_AWK_BINS = $(THIRD_PARTY_AWK_COMS) $(THIRD_PARTY_AWK_COMS:%=%.dbg)
|
THIRD_PARTY_AWK_BINS = $(THIRD_PARTY_AWK_COMS) $(THIRD_PARTY_AWK_COMS:%=%.dbg)
|
||||||
THIRD_PARTY_AWK_COMS = o/$(MODE)/third_party/awk/awk.com
|
THIRD_PARTY_AWK_COMS = o/$(MODE)/third_party/awk/awk
|
||||||
THIRD_PARTY_AWK_LIBS = $(THIRD_PARTY_AWK_A)
|
THIRD_PARTY_AWK_LIBS = $(THIRD_PARTY_AWK_A)
|
||||||
$(THIRD_PARTY_AWK_OBJS): $(BUILD_FILES) third_party/awk/BUILD.mk
|
$(THIRD_PARTY_AWK_OBJS): $(BUILD_FILES) third_party/awk/BUILD.mk
|
||||||
|
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue