Ignore:
Timestamp:
Apr 10, 2022, 2:53:18 PM (4 years ago)
Author:
JiadaL <j82liang@…>
Branches:
ADT, ast-experimental, enum, master, pthread-emulation, qualifiedEnum
Children:
d8e2a09
Parents:
4559b34 (diff), 6256891 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Resolve conflict

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tests/meta/dumpable.cfa

    r4559b34 r92538ab  
    1414//
    1515
     16#include <errno.h>
    1617#include <limits.h>
    17 #include <errno.h>
     18#include <string.h>
    1819
    1920#include <fstream.hfa>
    2021
    2122extern "C" {
     23        #include <fcntl.h>
     24        #include <unistd.h>
    2225        #include <sys/prctl.h>
    2326        #include <sys/resource.h>
    2427        #include <sys/statvfs.h>
    25         #include <unistd.h>
     28        #include <sys/stat.h>
     29        #include <sys/types.h>
    2630}
    2731
     
    7276        }
    7377
    74         if((buf.f_bsize * buf.f_bavail) < 536870912) {
    75                 serr | "Available diskspace is less than ~500Mb: " | (buf.f_bsize * buf.f_bavail);
     78        uint64_t avail = buf.f_bavail;
     79        avail *= buf.f_bsize;
     80        if(avail < 536870912_l64u) {
     81                serr | "Available diskspace is less than ~500Mb: " | avail;
    7682        }
    7783
     
    100106}
    101107
     108void check_core_pattern() {
     109        int ret;
     110        int cp = open("/proc/sys/kernel/core_pattern", 0, O_RDONLY);
     111        if(cp < 0) {
     112                perror("open(/proc/sys/kernel/core_pattern, O_RDONLY) error");
     113                return;
     114        }
     115
     116        try {
     117                const char * expected = "core\n";
     118                const int sz = sizeof("core\n");
     119                char buf[512];
     120                ret = read(cp, buf, 512);
     121                if(ret < 0) {
     122                        perror("first core pattern read error");
     123                        return;
     124                }
     125                ret = strncmp(expected, buf, sz - 1);
     126                if(ret != 0) {
     127                        serr | "/proc/sys/kernel/core_pattern does not contain 'core', was:" | nl | nl | buf | nl
     128                             | "Test script expect cores files to be dumped with name 'core' in current working directory." | nl
     129                             | "Apport is not supported, it should be deactivated in /etc/default/apport for the test suite to work with core dumps.";
     130
     131                        return;
     132                }
     133        }
     134        finally {
     135                ret = close(cp);
     136                if(ret < 0) perror("close(/proc/sys/kernel/core_pattern) error");
     137        }
     138
     139}
     140
    102141int main() {
    103142        check_ulimit();
     
    111150        check_dumpflag();
    112151
     152        check_core_pattern();
     153
    113154        sout | "Done";
    114155}
Note: See TracChangeset for help on using the changeset viewer.