Beispiel #1
0
void _ecore_fps_debug_shutdown(void)
{
	_ecore_fps_debug_init_count--;
	if (_ecore_fps_debug_init_count > 0)
		return;
	if (_ecore_fps_debug_fd >= 0) {
		char buf[4096];
		const char *tmp;
		int pid;

#ifndef HAVE_EVIL
		tmp = "/tmp";
#else
		tmp = (char *) evil_tmpdir_get();
#endif				/* HAVE_EVIL */
		pid = (int) getpid();
		snprintf(buf, sizeof(buf), "%s/.ecore_fps_debug-%i", tmp,
			 pid);
		unlink(buf);
		if (_ecore_fps_runtime_mmap) {
			munmap(_ecore_fps_runtime_mmap, sizeof(int));
			_ecore_fps_runtime_mmap = NULL;
		}
		close(_ecore_fps_debug_fd);
		_ecore_fps_debug_fd = -1;
	}
}
Beispiel #2
0
void
_ecore_fps_debug_init(void)
{
    char buf[PATH_MAX];
    const char *tmp;
    int pid;

    _ecore_fps_debug_init_count++;
    if (_ecore_fps_debug_init_count > 1) return;

#ifndef HAVE_EVIL
    tmp = "/tmp";
#else
    tmp = evil_tmpdir_get ();
#endif /* HAVE_EVIL */
    pid = (int)getpid();
    snprintf(buf, sizeof(buf), "%s/.ecore_fps_debug-%i", tmp, pid);
    _ecore_fps_debug_fd = open(buf, O_CREAT | O_TRUNC | O_RDWR, 0644);
    if (_ecore_fps_debug_fd < 0)
    {
        unlink(buf);
        _ecore_fps_debug_fd = open(buf, O_CREAT | O_TRUNC | O_RDWR, 0644);
    }
    if (_ecore_fps_debug_fd >= 0)
    {
        unsigned int zero = 0;
        char *buf2 = (char *)&zero;
        ssize_t todo = sizeof(unsigned int);

        while (todo > 0)
        {
            ssize_t r = write(_ecore_fps_debug_fd, buf2, todo);
            if (r > 0)
            {
                todo -= r;
                buf2 += r;
            }
            else if ((r < 0) && (errno == EINTR))
                continue;
            else
            {
                ERR("could not write to file '%s' fd %d: %s",
                    tmp, _ecore_fps_debug_fd, strerror(errno));
                close(_ecore_fps_debug_fd);
                _ecore_fps_debug_fd = -1;
                return;
            }
        }
        _ecore_fps_runtime_mmap = mmap(NULL, sizeof(unsigned int),
                                       PROT_READ | PROT_WRITE,
                                       MAP_SHARED,
                                       _ecore_fps_debug_fd, 0);
        if (_ecore_fps_runtime_mmap == MAP_FAILED)
            _ecore_fps_runtime_mmap = NULL;
    }
}
Beispiel #3
0
END_TEST

START_TEST(eolian_override_generation)
{
   char output_filepath[PATH_MAX] = "";
   snprintf(output_filepath, PATH_MAX, "%s/eolian_output.c",
#ifdef HAVE_EVIL
         (char *)evil_tmpdir_get()
#else
         "/tmp"
#endif
         );
   remove(output_filepath);
   fail_if(0 != _eolian_gen_execute(PACKAGE_DATA_DIR"/data/override.eo", "--eo --gc", output_filepath));
   fail_if(!_files_compare(PACKAGE_DATA_DIR"/data/override_ref.c", output_filepath));
}
Beispiel #4
0
END_TEST

START_TEST(eolian_import)
{
   char output_filepath[PATH_MAX] = "";
   snprintf(output_filepath, PATH_MAX, "%s/eolian_import_types.h",
#ifdef HAVE_EVIL
         (char *)evil_tmpdir_get()
#else
         "/tmp"
#endif
         );
   remove(output_filepath);
   fail_if(0 != _eolian_gen_execute(PACKAGE_DATA_DIR"/data/import_types.eot", "--gh", output_filepath));
   fail_if(!_files_compare(PACKAGE_DATA_DIR"/data/import_types_ref.h", output_filepath));
   remove(output_filepath);
}
Beispiel #5
0
END_TEST

START_TEST(eolian_functions_descriptions)
{
   char output_filepath[PATH_MAX] = "";
   snprintf(output_filepath, PATH_MAX, "%s/eolian_output.h",
#ifdef HAVE_EVIL
         (char *)evil_tmpdir_get()
#else
         "/tmp"
#endif
         );
   remove(output_filepath);
   fail_if(0 != _eolian_gen_execute(PACKAGE_DATA_DIR"/data/class_simple.eo", "--eo --gh", output_filepath));
   fail_if(!_files_compare(PACKAGE_DATA_DIR"/data/class_simple_ref_eo.h", output_filepath));
   remove(output_filepath);
   fail_if(0 != _eolian_gen_execute(PACKAGE_DATA_DIR"/data/class_simple.eo", "--legacy --gh", output_filepath));
   fail_if(!_files_compare(PACKAGE_DATA_DIR"/data/class_simple_ref_legacy.h", output_filepath));
}