Fossil SCM

Merge in small fixes to the test suite and plan to continue improving the suite in the trunk. Also kludge login.c on MinGW which has no strtok_r() available in its libc by supplying a public domain one. There certainly is a better way to deal with this, but this unbreaks the build on Windows broken by [315cf2436].

rberteig 2017-03-14 01:55 trunk merge
Commit 93d52a010f07a08ceea61aed4eadd53632ebd4338c024678f581e2835a612ff8
+38
--- src/login.c
+++ src/login.c
@@ -48,10 +48,48 @@
4848
# if defined(__MINGW32__) || defined(_MSC_VER)
4949
# define sleep Sleep /* windows does not have sleep, but Sleep */
5050
# endif
5151
#endif
5252
#include <time.h>
53
+
54
+#if defined(__MINGW32__) || defined(_MSC_VER)
55
+/*
56
+** MinGW doesn't have strtok_r in its libc. Here's a public domain one
57
+** found at StackOverflow as a work-around, with formatting adjusted to
58
+** make it more like the usual style here. This is certainly the wrong
59
+** place for it, which is emphasized by making the function static.
60
+**
61
+** See http://stackoverflow.com/a/12979321/68204
62
+**
63
+** public domain strtok_r() by Charlie Gordon
64
+** from comp.lang.c 9/14/2007
65
+** http://groups.google.com/group/comp.lang.c/msg/2ab1ecbb86646684
66
+** (Declaration that it's public domain):
67
+** http://groups.google.com/group/comp.lang.c/msg/7c7b39328fefab9c
68
+*/
69
+static char* strtok_r(
70
+ char *str,
71
+ const char *delim,
72
+ char **nextp
73
+){
74
+ char *ret;
75
+ if( str == NULL ){
76
+ str = *nextp;
77
+ }
78
+ str += strspn(str, delim);
79
+ if( *str == '\0' ){
80
+ return NULL;
81
+ }
82
+ ret = str;
83
+ str += strcspn(str, delim);
84
+ if( *str ){
85
+ *str++ = '\0';
86
+ }
87
+ *nextp = str;
88
+ return ret;
89
+}
90
+#endif
5391
5492
/*
5593
** Return the login-group name. Or return 0 if this repository is
5694
** not a member of a login-group.
5795
*/
5896
--- src/login.c
+++ src/login.c
@@ -48,10 +48,48 @@
48 # if defined(__MINGW32__) || defined(_MSC_VER)
49 # define sleep Sleep /* windows does not have sleep, but Sleep */
50 # endif
51 #endif
52 #include <time.h>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
53
54 /*
55 ** Return the login-group name. Or return 0 if this repository is
56 ** not a member of a login-group.
57 */
58
--- src/login.c
+++ src/login.c
@@ -48,10 +48,48 @@
48 # if defined(__MINGW32__) || defined(_MSC_VER)
49 # define sleep Sleep /* windows does not have sleep, but Sleep */
50 # endif
51 #endif
52 #include <time.h>
53
54 #if defined(__MINGW32__) || defined(_MSC_VER)
55 /*
56 ** MinGW doesn't have strtok_r in its libc. Here's a public domain one
57 ** found at StackOverflow as a work-around, with formatting adjusted to
58 ** make it more like the usual style here. This is certainly the wrong
59 ** place for it, which is emphasized by making the function static.
60 **
61 ** See http://stackoverflow.com/a/12979321/68204
62 **
63 ** public domain strtok_r() by Charlie Gordon
64 ** from comp.lang.c 9/14/2007
65 ** http://groups.google.com/group/comp.lang.c/msg/2ab1ecbb86646684
66 ** (Declaration that it's public domain):
67 ** http://groups.google.com/group/comp.lang.c/msg/7c7b39328fefab9c
68 */
69 static char* strtok_r(
70 char *str,
71 const char *delim,
72 char **nextp
73 ){
74 char *ret;
75 if( str == NULL ){
76 str = *nextp;
77 }
78 str += strspn(str, delim);
79 if( *str == '\0' ){
80 return NULL;
81 }
82 ret = str;
83 str += strcspn(str, delim);
84 if( *str ){
85 *str++ = '\0';
86 }
87 *nextp = str;
88 return ret;
89 }
90 #endif
91
92 /*
93 ** Return the login-group name. Or return 0 if this repository is
94 ** not a member of a login-group.
95 */
96
+38
--- src/login.c
+++ src/login.c
@@ -48,10 +48,48 @@
4848
# if defined(__MINGW32__) || defined(_MSC_VER)
4949
# define sleep Sleep /* windows does not have sleep, but Sleep */
5050
# endif
5151
#endif
5252
#include <time.h>
53
+
54
+#if defined(__MINGW32__) || defined(_MSC_VER)
55
+/*
56
+** MinGW doesn't have strtok_r in its libc. Here's a public domain one
57
+** found at StackOverflow as a work-around, with formatting adjusted to
58
+** make it more like the usual style here. This is certainly the wrong
59
+** place for it, which is emphasized by making the function static.
60
+**
61
+** See http://stackoverflow.com/a/12979321/68204
62
+**
63
+** public domain strtok_r() by Charlie Gordon
64
+** from comp.lang.c 9/14/2007
65
+** http://groups.google.com/group/comp.lang.c/msg/2ab1ecbb86646684
66
+** (Declaration that it's public domain):
67
+** http://groups.google.com/group/comp.lang.c/msg/7c7b39328fefab9c
68
+*/
69
+static char* strtok_r(
70
+ char *str,
71
+ const char *delim,
72
+ char **nextp
73
+){
74
+ char *ret;
75
+ if( str == NULL ){
76
+ str = *nextp;
77
+ }
78
+ str += strspn(str, delim);
79
+ if( *str == '\0' ){
80
+ return NULL;
81
+ }
82
+ ret = str;
83
+ str += strcspn(str, delim);
84
+ if( *str ){
85
+ *str++ = '\0';
86
+ }
87
+ *nextp = str;
88
+ return ret;
89
+}
90
+#endif
5391
5492
/*
5593
** Return the login-group name. Or return 0 if this repository is
5694
** not a member of a login-group.
5795
*/
5896
--- src/login.c
+++ src/login.c
@@ -48,10 +48,48 @@
48 # if defined(__MINGW32__) || defined(_MSC_VER)
49 # define sleep Sleep /* windows does not have sleep, but Sleep */
50 # endif
51 #endif
52 #include <time.h>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
53
54 /*
55 ** Return the login-group name. Or return 0 if this repository is
56 ** not a member of a login-group.
57 */
58
--- src/login.c
+++ src/login.c
@@ -48,10 +48,48 @@
48 # if defined(__MINGW32__) || defined(_MSC_VER)
49 # define sleep Sleep /* windows does not have sleep, but Sleep */
50 # endif
51 #endif
52 #include <time.h>
53
54 #if defined(__MINGW32__) || defined(_MSC_VER)
55 /*
56 ** MinGW doesn't have strtok_r in its libc. Here's a public domain one
57 ** found at StackOverflow as a work-around, with formatting adjusted to
58 ** make it more like the usual style here. This is certainly the wrong
59 ** place for it, which is emphasized by making the function static.
60 **
61 ** See http://stackoverflow.com/a/12979321/68204
62 **
63 ** public domain strtok_r() by Charlie Gordon
64 ** from comp.lang.c 9/14/2007
65 ** http://groups.google.com/group/comp.lang.c/msg/2ab1ecbb86646684
66 ** (Declaration that it's public domain):
67 ** http://groups.google.com/group/comp.lang.c/msg/7c7b39328fefab9c
68 */
69 static char* strtok_r(
70 char *str,
71 const char *delim,
72 char **nextp
73 ){
74 char *ret;
75 if( str == NULL ){
76 str = *nextp;
77 }
78 str += strspn(str, delim);
79 if( *str == '\0' ){
80 return NULL;
81 }
82 ret = str;
83 str += strcspn(str, delim);
84 if( *str ){
85 *str++ = '\0';
86 }
87 *nextp = str;
88 return ret;
89 }
90 #endif
91
92 /*
93 ** Return the login-group name. Or return 0 if this repository is
94 ** not a member of a login-group.
95 */
96
+4 -4
--- test/json.test
+++ test/json.test
@@ -749,14 +749,14 @@
749749
750750
751751
# FOSSIL-1103 FSL_JSON_E_UNKNOWN
752752
# Unknown error
753753
754
-write_file bad.sql {
755
-CREATE TABLE spam(a integer, b text);
756
-}
757
-exec $::fossilexe sqlite3 --no-repository bad.fossil <bad.sql
754
+#write_file bad.sql {
755
+#CREATE TABLE spam(a integer, b text);
756
+#}
757
+#exec $::fossilexe sqlite3 --no-repository bad.fossil <bad.sql
758758
#fossil_json HAI -R bad.fossil -expectError
759759
760760
# FOSSIL-1104 FSL_JSON_E_TIMEOUT
761761
# Timeout reached
762762
# FOSSIL-1105 FSL_JSON_E_ASSERT
763763
--- test/json.test
+++ test/json.test
@@ -749,14 +749,14 @@
749
750
751 # FOSSIL-1103 FSL_JSON_E_UNKNOWN
752 # Unknown error
753
754 write_file bad.sql {
755 CREATE TABLE spam(a integer, b text);
756 }
757 exec $::fossilexe sqlite3 --no-repository bad.fossil <bad.sql
758 #fossil_json HAI -R bad.fossil -expectError
759
760 # FOSSIL-1104 FSL_JSON_E_TIMEOUT
761 # Timeout reached
762 # FOSSIL-1105 FSL_JSON_E_ASSERT
763
--- test/json.test
+++ test/json.test
@@ -749,14 +749,14 @@
749
750
751 # FOSSIL-1103 FSL_JSON_E_UNKNOWN
752 # Unknown error
753
754 #write_file bad.sql {
755 #CREATE TABLE spam(a integer, b text);
756 #}
757 #exec $::fossilexe sqlite3 --no-repository bad.fossil <bad.sql
758 #fossil_json HAI -R bad.fossil -expectError
759
760 # FOSSIL-1104 FSL_JSON_E_TIMEOUT
761 # Timeout reached
762 # FOSSIL-1105 FSL_JSON_E_ASSERT
763
+12 -6
--- test/wiki.test
+++ test/wiki.test
@@ -21,16 +21,22 @@
2121
test_setup
2222
2323
# Return true if two files are similar (i.e. not only compress trailing spaces
2424
# from a line, but remove any final LF from the file as well)
2525
proc similar_file {a b} {
26
- set x [read_file $a]
27
- regsub -all { +\n} $x \n x
28
- regsub -all {\n$} $x {} x
29
- set y [read_file $b]
30
- regsub -all { +\n} $y \n y
31
- regsub -all {\n$} $y {} y
26
+ set x ""
27
+ if {[file exists $a]} {
28
+ set x [read_file $a]
29
+ regsub -all { +\n} $x \n x
30
+ regsub -all {\n$} $x {} x
31
+ }
32
+ set y ""
33
+ if {[file exists $b]} {
34
+ set y [read_file $b]
35
+ regsub -all { +\n} $y \n y
36
+ regsub -all {\n$} $y {} y
37
+ }
3238
return [expr {$x==$y}]
3339
}
3440
3541
# Return the mime type in the manifest for a given wiki page
3642
# Defaults to "error: some text" if the manifest can't be located and
3743
--- test/wiki.test
+++ test/wiki.test
@@ -21,16 +21,22 @@
21 test_setup
22
23 # Return true if two files are similar (i.e. not only compress trailing spaces
24 # from a line, but remove any final LF from the file as well)
25 proc similar_file {a b} {
26 set x [read_file $a]
27 regsub -all { +\n} $x \n x
28 regsub -all {\n$} $x {} x
29 set y [read_file $b]
30 regsub -all { +\n} $y \n y
31 regsub -all {\n$} $y {} y
 
 
 
 
 
 
32 return [expr {$x==$y}]
33 }
34
35 # Return the mime type in the manifest for a given wiki page
36 # Defaults to "error: some text" if the manifest can't be located and
37
--- test/wiki.test
+++ test/wiki.test
@@ -21,16 +21,22 @@
21 test_setup
22
23 # Return true if two files are similar (i.e. not only compress trailing spaces
24 # from a line, but remove any final LF from the file as well)
25 proc similar_file {a b} {
26 set x ""
27 if {[file exists $a]} {
28 set x [read_file $a]
29 regsub -all { +\n} $x \n x
30 regsub -all {\n$} $x {} x
31 }
32 set y ""
33 if {[file exists $b]} {
34 set y [read_file $b]
35 regsub -all { +\n} $y \n y
36 regsub -all {\n$} $y {} y
37 }
38 return [expr {$x==$y}]
39 }
40
41 # Return the mime type in the manifest for a given wiki page
42 # Defaults to "error: some text" if the manifest can't be located and
43

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button