forked from enlightenment/terminology
tytest: add write buffer to checksum
This commit is contained in:
parent
e0ed4b4ad9
commit
5cef3b68b6
|
@ -56,6 +56,7 @@ tyfuzz_sources = ['termptyesc.c', 'termptyesc.h',
|
|||
'termpty.c', 'termpty.h',
|
||||
'config.c', 'config.h',
|
||||
'col.c', 'col.h',
|
||||
'sb.c', 'sb.h',
|
||||
'tyfuzz.c']
|
||||
tytest_sources = ['termptyesc.c', 'termptyesc.h',
|
||||
'termptysave.c', 'termptysave.h',
|
||||
|
@ -66,6 +67,7 @@ tytest_sources = ['termptyesc.c', 'termptyesc.h',
|
|||
'termpty.c', 'termpty.h',
|
||||
'config.c', 'config.h',
|
||||
'col.c', 'col.h',
|
||||
'sb.c', 'sb.h',
|
||||
'md5/md5.c', 'md5/md5.h',
|
||||
'tytest.c']
|
||||
|
||||
|
|
|
@ -1241,15 +1241,18 @@ termpty_cell_get(Termpty *ty, int y_requested, int x_requested)
|
|||
void
|
||||
termpty_write(Termpty *ty, const char *input, int len)
|
||||
{
|
||||
#if defined(ENABLE_TESTS)
|
||||
ty_sb_add(&ty->write_buffer, input, len);
|
||||
#else
|
||||
int fd = ty->fd;
|
||||
|
||||
#if defined(ENABLE_FUZZING) || defined(ENABLE_TESTS)
|
||||
#if defined(ENABLE_FUZZING)
|
||||
fd = ty->fd_dev_null;
|
||||
#endif
|
||||
if (fd < 0) return;
|
||||
if (write(fd, input, len) < 0)
|
||||
ERR(_("Could not write to file descriptor %d: %s"),
|
||||
fd, strerror(errno));
|
||||
#endif
|
||||
}
|
||||
|
||||
struct screen_info
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
#include "config.h"
|
||||
#include "media.h"
|
||||
#include "sb.h"
|
||||
|
||||
typedef struct _Termcell Termcell;
|
||||
typedef struct _Termatt Termatt;
|
||||
|
@ -163,7 +164,10 @@ struct _Termpty
|
|||
Backlog_Beacon backlog_beacon;
|
||||
int w, h;
|
||||
int fd, slavefd;
|
||||
#if defined(ENABLE_FUZZING) || defined(ENABLE_TESTS)
|
||||
#if defined(ENABLE_TESTS)
|
||||
struct ty_sb write_buffer;
|
||||
#endif
|
||||
#if defined(ENABLE_FUZZING)
|
||||
int fd_dev_null;
|
||||
#endif
|
||||
struct {
|
||||
|
|
|
@ -172,8 +172,12 @@ _tytest_checksum(Termpty *ty)
|
|||
{
|
||||
MD5Update(&ctx, (unsigned char const*)"(NULL)", 6);
|
||||
}
|
||||
/* Cursor shape */
|
||||
MD5Update(&ctx, (unsigned char const*)_cursor_shape,
|
||||
strlen(_cursor_shape));
|
||||
/* Write buffer */
|
||||
MD5Update(&ctx, (unsigned char const*)ty->write_buffer.buf,
|
||||
ty->write_buffer.len);
|
||||
|
||||
MD5Final(hash, &ctx);
|
||||
|
||||
|
@ -205,8 +209,10 @@ _termpty_init(Termpty *ty)
|
|||
assert(ty->screen2);
|
||||
ty->circular_offset = 0;
|
||||
ty->fd = STDIN_FILENO;
|
||||
#if defined(ENABLE_FUZZING)
|
||||
ty->fd_dev_null = open("/dev/null", O_WRONLY|O_APPEND);
|
||||
assert(ty->fd_dev_null >= 0);
|
||||
#endif
|
||||
ty->hl.bitmap = calloc(1, HL_LINKS_MAX / 8); /* bit map for 1 << 16 elements */
|
||||
assert(ty->hl.bitmap);
|
||||
/* Mark id 0 as set */
|
||||
|
@ -216,7 +222,12 @@ _termpty_init(Termpty *ty)
|
|||
static void
|
||||
_termpty_shutdown(Termpty *ty)
|
||||
{
|
||||
#if defined(ENABLE_TESTS)
|
||||
ty_sb_free(&ty->write_buffer);
|
||||
#endif
|
||||
#if defined(ENABLE_FUZZING)
|
||||
close(ty->fd_dev_null);
|
||||
#endif
|
||||
}
|
||||
|
||||
int
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
#!/bin/sh
|
||||
|
||||
# fill space with E
|
||||
printf '\033#8'
|
||||
#set color
|
||||
printf '\033[46;31;3m'
|
||||
|
||||
printf '\033[?26n'
|
|
@ -14,8 +14,9 @@ cursor-shape-5.sh 21332951c006a2d91cf0f227758ff477
|
|||
cursor-shape-6.sh 21332951c006a2d91cf0f227758ff477
|
||||
cursor-shape-7.sh 5d0dadf7273d918cbcd99df95e56795e
|
||||
tabs.sh 960b74686e23e8e39c3446768b9efc75
|
||||
xterm-osc-0-title-icon.sh cb5080cc1dbc23b553b62fbdc8cbdf68
|
||||
xterm-osc-1-icon.sh 9202db6e81ce810f007035770934fecb
|
||||
xterm-osc-2-title.sh 49a058f1813bdd64faab1cf1af3ebe09
|
||||
dsr-cpr.sh 5a778fd856455475e695e5469e69d227
|
||||
dsr-dir.sh f7dde335d44f8691041d40c3efd24ffb
|
||||
xterm-osc-0-title-icon.sh edae688004c15739bcc5a10f51faa6ed
|
||||
xterm-osc-1-icon.sh be549a661504e4dcfb974dcccd7b0bdf
|
||||
xterm-osc-2-title.sh e8485fd460aba2a2ae1d4e63a1143b32
|
||||
dsr-cpr.sh a03cfba07a7b76075a4126f452d48ad5
|
||||
dsr-dir.sh 28b0d8b4b60f3c61d49cee69895a07b2
|
||||
dsr-kbd.sh 1c474c101697080a85563d9b5bc1505c
|
||||
|
|
Loading…
Reference in New Issue