File: runbg.c

package info (click to toggle)
libite 2.6.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,188 kB
  • sloc: sh: 4,665; ansic: 4,165; makefile: 141
file content (23 lines) | stat: -rw-r--r-- 407 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include "check.h"

#define file "/tmp/runbg.txt"

int main(void)
{
	char *cmd[] = {
		"sh", "-c", "echo 'hello world' > " file, NULL
	};

	erase(file);
	test(runbg(cmd, 100000), "Calling runbg");

	if (test(fexist(file), "Verifying %s does not yet exist", file))
		return 1;

	test(sleep(1), "Waiting for runbg");

	if (test(!fexist(file), "Verifying %s has been created", file))
		return 1;

	return 0;
}