xmake-io / xmake

🔥 A cross-platform build utility based on Lua
https://xmake.io
Apache License 2.0
9.87k stars 776 forks source link

xmake将xmake test程序的stdout输出存入/tmp导致/tmp目录被塞满 #5450

Closed ZtRXR closed 1 month ago

ZtRXR commented 1 month ago

Xmake 版本

xmake v2.9.4+20240729

操作系统版本和架构

Linux archlinux 6.10.3-arch1-2 #1 SMP PREEMPT_DYNAMIC Tue, 06 Aug 2024 07:21:19 +0000 x86_64 GNU/Linux

描述问题

xmake test时程序输出stdout内容过多导致/tmp被塞满,导致其他程序无法使用/tmp 而且xmake报error中没有有关/tmp储存空间不足的报错信息,导致排错困难 谢谢你对C++开发构建工具的支持

期待的结果

我希望能把程序输出存入xmake.lua所在目录下 更好的报错信息支持 谢谢你对C++开发构建工具的支持

工程配置

target("stdout_test")
    set_kind("binary")
    add_files("./src/*.cpp")
    add_tests("1")

附加信息和错误日志

$ xmake b -vD
checking for the c++ compiler (cxx) ... gcc
[ 28%]: cache compiling.debug day5/RMQ/st_done.cpp
/usr/bin/gcc -c -m64 -g -O0 -DOIPRINT -o build/.objs/st_done/linux/x86_64/debug/day5/RMQ/st_done.cpp.o day5/RMQ/st_done.cpp
[ 32%]: cache compiling.debug day6/pre88/pre88.cpp
/usr/bin/gcc -c -m64 -g -O0 -DOIPRINT -o build/.objs/pre88/linux/x86_64/debug/day6/pre88/pre88.cpp.o day6/pre88/pre88.cpp
[ 35%]: cache compiling.debug day5/RMQ/st_raw.cpp
/usr/bin/gcc -c -m64 -g -O0 -DOIPRINT -o build/.objs/st_raw/linux/x86_64/debug/day5/RMQ/st_raw.cpp.o day5/RMQ/st_raw.cpp
[ 39%]: cache compiling.debug test.cpp
/usr/bin/gcc -c -m64 -g -O0 -DOIPRINT -o build/.objs/test/linux/x86_64/debug/test.cpp.o test.cpp
[ 42%]: cache compiling.debug day5/perfect/fix.cpp
/usr/bin/gcc -c -m64 -g -O0 -DOIPRINT -o build/.objs/fperfect/linux/x86_64/debug/day5/perfect/fix.cpp.o day5/perfect/fix.cpp
[ 46%]: cache compiling.debug day6/binaryExponentiation/binaryExponentiation.cpp
/usr/bin/gcc -c -m64 -g -O0 -DOIPRINT -o build/.objs/binExp/linux/x86_64/debug/day6/binaryExponentiation/binaryExponentiation.cpp.o day6/binaryExponentiation/binaryExponentiation.cpp
error: @programdir/core/main.lua:329: @programdir/actions/build/main.lua:148: @programdir/modules/async/runjobs.lua:325: @programdir/modules/private/action/build/object.lua:91: @programdir/modules/core/tools/gcc.lua:919: 
stack traceback:
    [C]: in function 'error'
    [@programdir/core/base/os.lua:973]:
    [@programdir/modules/core/tools/gcc.lua:919]: in function 'catch'
    [@programdir/core/sandbox/modules/try.lua:123]: in function 'try'
    [@programdir/modules/core/tools/gcc.lua:860]:
    [C]: in function 'xpcall'
    [@programdir/core/base/utils.lua:275]:
    [@programdir/core/tool/compiler.lua:278]: in function 'compile'
    [@programdir/modules/private/action/build/object.lua:91]: in function 'script'
    [@programdir/modules/private/action/build/object.lua:122]: in function 'build_object'
    [@programdir/modules/private/action/build/object.lua:147]: in function 'jobfunc'
    [@programdir/modules/async/runjobs.lua:241]:
    [C]: in function 'xpcall'
    [@programdir/core/base/utils.lua:275]: in function 'trycall'
    [@programdir/core/sandbox/modules/try.lua:117]: in function 'try'
    [@programdir/modules/async/runjobs.lua:223]: in function 'cotask'
    [@programdir/core/base/scheduler.lua:406]:

stack traceback:
        [C]: in function 'error'
        @programdir/core/base/os.lua:973: in function 'base/os.raiselevel'
        (...tail calls...)
        @programdir/core/main.lua:329: in upvalue 'cotask'
        @programdir/core/base/scheduler.lua:406: in function <@programdir/core/base/scheduler.lua:399>

同时df -h信息

$ df -h
tmpfs           952M  952M     0 100% /tmp
Issues-translate-bot commented 1 month ago

Bot detected the issue body's language is not English, translate it automatically.


Title: xmake will store the stdout output of the xmake test program into /tmp, causing the /tmp directory to be filled up

waruqi commented 1 month ago

按理,不管 test 是否执行成功,tmpfile 都会自动删了的,不会无限增长才对。。你可以调下这里。。

https://github.com/xmake-io/xmake/blob/af3090adbb8e46ee8e3d62417e9a6dc9b06f068c/xmake/actions/test/main.lua#L89

Issues-translate-bot commented 1 month ago

Bot detected the issue body's language is not English, translate it automatically.


It stands to reason that regardless of whether test is executed successfully, tmpfile will be automatically deleted and will not grow indefinitely. . You can adjust it here. .

https://github.com/xmake-io/xmake/blob/af3090adbb8e46ee8e3d62417e9a6dc9b06f068c/xmake/actions/test/main.lua#L89

ZtRXR commented 1 month ago

可能是因为程序死循环输出我手动CTRL+C了导致没有执行成功? 那该如何解决

Issues-translate-bot commented 1 month ago

Bot detected the issue body's language is not English, translate it automatically.


Maybe it's because the program outputs in an infinite loop and I manually CTRL+C, causing the execution to fail? How to solve it

ZtRXR commented 1 month ago

写代码时我经常使用stdout输出,有时候逻辑有问题容易死循环输出,tmp就满了,麻烦作者修复下,这很重要

Issues-translate-bot commented 1 month ago

Bot detected the issue body's language is not English, translate it automatically.


When writing code, I often use stdout output. Sometimes there is a problem with the logic and it is easy to output in an infinite loop. The tmp will be full. I would like the author to fix it. This is very important.

ZtRXR commented 1 month ago

或者保证他不会占用过大空间,或者下次运行xmake任何命令时清空tmp占用,都可以

Issues-translate-bot commented 1 month ago

Bot detected the issue body's language is not English, translate it automatically.


Or make sure it doesn't take up too much space, or clear the tmp space when you run any xmake command next time.

waruqi commented 1 month ago

可以了,xmake update -s dev

Issues-translate-bot commented 1 month ago

Bot detected the issue body's language is not English, translate it automatically.


That’s it, xmake update -s dev

ZtRXR commented 1 month ago

感谢您修复

Issues-translate-bot commented 1 month ago

Bot detected the issue body's language is not English, translate it automatically.


Thanks for fixing