aboutsummaryrefslogtreecommitdiffstats
path: root/libical/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'libical/src/test')
-rw-r--r--libical/src/test/recur.c18
-rw-r--r--libical/src/test/testclassify.c1
-rw-r--r--libical/src/test/testvcal.c10
3 files changed, 23 insertions, 6 deletions
diff --git a/libical/src/test/recur.c b/libical/src/test/recur.c
index 95dd3b08a3..f4d9a38647 100644
--- a/libical/src/test/recur.c
+++ b/libical/src/test/recur.c
@@ -31,10 +31,17 @@
#include <stdlib.h> /* for malloc */
#include <stdio.h> /* for printf */
#include <time.h> /* for time() */
+#include <signal.h> /* for signal */
+#include <unistd.h> /* for alarm */
#include "icalmemory.h"
#include "icaldirset.h"
#include "icalfileset.h"
+static void sig_alrm(int i){
+ fprintf(stderr,"Could not get lock on file\n");
+ exit(1);
+}
+
int main(int argc, char *argv[])
{
icalfileset *cin;
@@ -46,9 +53,10 @@ int main(int argc, char *argv[])
time_t tt;
char* file;
- icalerror_set_error_state(ICAL_MALFORMEDDATA_ERROR, ICAL_ERROR_NONFATAL);
icalerror_set_error_state(ICAL_PARSE_ERROR, ICAL_ERROR_NONFATAL);
+ signal(SIGALRM,sig_alrm);
+
if (argc <= 1){
file = "../../test-data/recur.txt";
@@ -59,8 +67,10 @@ int main(int argc, char *argv[])
exit(1);
}
+ alarm(300); /* to get file lock */
cin = icalfileset_new(file);
-
+ alarm(0);
+
if(cin == 0){
fprintf(stderr,"recur: can't open file %s\n",file);
exit(1);
@@ -82,6 +92,8 @@ int main(int argc, char *argv[])
continue;
}
+ printf("\n\n#### %s\n",icalproperty_get_description(desc));
+ printf("#### %s\n",icalvalue_as_ical_string(icalproperty_get_value(rrule)));
recur = icalproperty_get_rrule(rrule);
start = icalproperty_get_dtstart(dtstart);
@@ -89,8 +101,6 @@ int main(int argc, char *argv[])
tt = icaltime_as_timet(start);
- printf("\n\n#### %s\n",icalproperty_get_description(desc));
- printf("#### %s\n",icalvalue_as_ical_string(icalproperty_get_value(rrule)));
printf("#### %s\n",ctime(&tt ));
for(ritr = icalrecur_iterator_new(recur,start),
diff --git a/libical/src/test/testclassify.c b/libical/src/test/testclassify.c
index 821baac251..2c6c785dfa 100644
--- a/libical/src/test/testclassify.c
+++ b/libical/src/test/testclassify.c
@@ -31,7 +31,6 @@
#include <string.h> /* For strerror */
#include "icalset.h"
#include "icalclassify.h"
-#include "icalssutil.h"
struct class_map {
diff --git a/libical/src/test/testvcal.c b/libical/src/test/testvcal.c
index 4777162623..f82adffcc8 100644
--- a/libical/src/test/testvcal.c
+++ b/libical/src/test/testvcal.c
@@ -41,8 +41,16 @@ int main(int argc, char* argv[])
{
VObject *vcal = 0;
icalcomponent *comp;
+ char* file;
- vcal = Parse_MIME_FromFileName(argv[1]);
+ if (argc != 2){
+ file = "../../test-data/user-cal.vcf";
+ } else {
+ file = argv[1];
+ }
+
+
+ vcal = Parse_MIME_FromFileName(file);
assert(vcal != 0);