mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-29 00:32:29 +00:00
Add automatic TMPDIR setup/teardown to GNU Make
We now guarantee TMPDIR will be defined on a per build rule basis. It'll be an absolute path. It'll be secure and unique. It'll be rm -rf'd after the last shell script line in your build rule is executed. If $TMPDIR is already defined, then it'll be created as a subdirectory of your $TMPDIR and then replace the variable with the new definition. The Landlock Make repository will be updated with examples shortly after this change which shall be known as Landlock Make 1.1.1. See #530
This commit is contained in:
parent
e1699c5b68
commit
d36d0634db
25 changed files with 387 additions and 357 deletions
|
@ -50,3 +50,8 @@ TEST(mkntpath, testRemoveDoubleSlash) {
|
|||
EXPECT_EQ(8, __mkntpath("\\\\?\\doge", p));
|
||||
EXPECT_STREQ(u"\\\\?\\doge", p);
|
||||
}
|
||||
|
||||
TEST(mkntpath, testJustC) {
|
||||
EXPECT_EQ(7, __mkntpath("/C", p));
|
||||
EXPECT_STREQ(u"\\\\?\\C:\\", p);
|
||||
}
|
||||
|
|
|
@ -534,8 +534,8 @@ void longstringislong_dupe(size_t size, char data[size], char dupe[size]) {
|
|||
BENCH(bench_00_strcmp, bench) {
|
||||
size_t size;
|
||||
char *dupe, *data;
|
||||
size = ROUNDDOWN(MAX(FRAMESIZE, getcachesize(kCpuCacheTypeData, 1)) / 2,
|
||||
PAGESIZE);
|
||||
|
||||
size = 14139;
|
||||
data = gc(malloc(size));
|
||||
dupe = gc(malloc(size));
|
||||
|
||||
|
@ -576,8 +576,7 @@ BENCH(bench_00_strcmp, bench) {
|
|||
BENCH(bench_01_strcasecmp, bench) {
|
||||
size_t size;
|
||||
char *dupe, *data;
|
||||
size = ROUNDDOWN(MAX(FRAMESIZE, getcachesize(kCpuCacheTypeData, 1)) / 2,
|
||||
PAGESIZE);
|
||||
size = 141393;
|
||||
data = gc(malloc(size));
|
||||
dupe = gc(malloc(size));
|
||||
|
||||
|
|
|
@ -17,8 +17,8 @@
|
|||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/math.h"
|
||||
#include "libc/stdio/rand.h"
|
||||
#include "libc/runtime/gc.internal.h"
|
||||
#include "libc/stdio/rand.h"
|
||||
#include "libc/testlib/ezbench.h"
|
||||
#include "libc/testlib/testlib.h"
|
||||
#include "libc/x/x.h"
|
||||
|
@ -67,7 +67,19 @@ TEST(fmodf, test) {
|
|||
EXPECT_STREQ("8e+20", gc(xdtoaf(fmodf(8e20, 32e20))));
|
||||
}
|
||||
|
||||
BENCH(fmod, bench) {
|
||||
EZBENCH2("fmod eze", donothing, fmodl(8, 32));
|
||||
EZBENCH2("fmod big", donothing, fmodl(5.319372648326541e+255, M_2_PI));
|
||||
BENCH(fmodf, bench) {
|
||||
EZBENCH2("fmodf eze", donothing, fmodf(8, 32));
|
||||
EZBENCH2("fmodf big", donothing, fmodf(5.319372648326541e+255, M_2_PI));
|
||||
}
|
||||
|
||||
BENCH(fmod, bench) {
|
||||
// fmod-tiny.S goes slow in the average case, fast for big case
|
||||
EZBENCH2("fmod eze", donothing, fmod(8, 32));
|
||||
// fmod.c goes fast for the average case very slow for big case
|
||||
EZBENCH2("fmod big", donothing, fmod(5.319372648326541e+255, M_2_PI));
|
||||
}
|
||||
|
||||
BENCH(fmodl, bench) {
|
||||
EZBENCH2("fmodl eze", donothing, fmodl(8, 32));
|
||||
EZBENCH2("fmodl big", donothing, fmodl(5.319372648326541e+255, M_2_PI));
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
-- PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
gotsigusr1 = false
|
||||
tmpdir = "o/tmp/lunix_test.%d" % {unix.getpid()}
|
||||
tmpdir = "%s/o/tmp/lunix_test.%d" % {os.getenv('TMPDIR'), unix.getpid()}
|
||||
|
||||
function string.starts(String,Start)
|
||||
return string.sub(String,1,string.len(Start))==Start
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
-- TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
-- PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
tmpdir = "o/tmp/lunix_test.%d" % {unix.getpid()}
|
||||
tmpdir = "%s/o/tmp/lunix_test.%d" % {os.getenv('TMPDIR'), unix.getpid()}
|
||||
|
||||
local function Path(name)
|
||||
return tmpdir .. '/' .. name
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue