kripken/emscripten — Issue #115: runtime failure on libogg framing test
Author: rillian
Created: 2011-11-08 01:04:46+00:00
State: open

I get a runtime failure with the framing self test from the libogg library. Possibly something to do with binary manipulation?

git clone https://git.xiph.org/mirrors/ogg.git
edit ogg/include/ogg/os_types.h to add:

diff --git a/include/ogg/os_types.h b/include/ogg/os_types.h
index ec49b6a..9cc9486 100644
--- a/include/ogg/os_types.h
+++ b/include/ogg/os_types.h
@@ -138,6 +138,15 @@
typedef unsigned int ogg_uint32_t;
typedef long long int ogg_int64_t;

+#elif defined(EMSCRIPTEN)
+
+ #include
+ typedef int16_t ogg_int16_t;
+ typedef uint16_t ogg_uint16_t;
+ typedef int32_t ogg_int32_t;
+ typedef uint32_t ogg_uint32_t;
+ typedef int64_t ogg_int64_t;
+
#else

# include

Then compile:
cd ogg/src
emmaken.py -D_V_SELFTEST -I../include framing.c -o test-framing.bc
emscripten.py test-framing.bc -o test-framing.js

Run the result:
d8 test-framing.js
testing single page encoding... 0, (0), granule:0 ok.
testing basic page encoding... 0, (0), granule:0 1, (1), granule:6151 ok.
testing basic nil packets... 0, (0), granule:0 1, (1), granule:10247 ok.
testing initial-packet lacing > 4k... 0, (0), granule:0 1, (1), granule:2055 ok.
testing single packet page span... 0, (0), granule:0 1, header content mismatch at pos 7:
(0)4f:4f (1)67:67 (2)67:67 (3)53:53 (4)00:00 (5)00:00 (6)ff:ff (7)ff:00 (8)ff:00 (9)ff:00 (10)ff:00 (11)ff:00 (12)ff:00 (13)ff:00 (14)01:01 (15)02:02 (16)03:03 (17)04:04 (18)01:01 (19)00:00 (20)00:00 (21)00:00 (22)f8:9e (23)3c:6f (24)19:3d (25)79:6d (26)ff:ff (27)ff:ff (28)ff:ff (29)ff:ff (30)ff:ff (31)ff:ff (32)ff:ff (33)ff:ff (34)ff:ff (35)ff:ff (36)ff:ff (37)ff:ff (38)ff:ff (39)ff:ff (40)ff:ff (41)ff:ff (42)ff:ff (43)ff:ff (44)ff:ff (45)ff:ff (46)ff:ff (47)ff:ff (48)ff:ff (49)ff:ff (50)ff:ff (51)ff:ff (52)ff:ff (53)ff:ff (54)ff:ff (55)ff:ff (56)ff:ff (57)ff:ff (58)ff:ff (59)ff:ff (60)ff:ff (61)ff:ff (62)ff:ff (63)ff:ff (64)ff:ff (65)ff:ff (66)ff:ff (67)ff:ff (68)ff:ff (69)ff:ff (70)ff:ff (71)ff:ff (72)ff:ff (73)ff:ff (74)ff:ff (75)ff:ff (76)ff:ff (77)ff:ff (78)ff:ff (79)ff:ff (80)ff:ff (81)ff:ff (82)ff:ff (83)ff:ff (84)ff:ff (85)ff:ff (86)ff:ff (87)ff:ff (88)ff:ff (89)ff:ff (90)ff:ff (91)ff:ff (92)ff:ff (93)ff:ff (94)ff:ff (95)ff:ff (96)ff:ff (97)ff:ff (98)ff:ff (99)ff:ff (100)ff:ff (101)ff:ff (102)ff:ff (103)ff:ff (104)ff:ff (105)ff:ff (106)ff:ff (107)ff:ff (108)ff:ff (109)ff:ff (110)ff:ff (111)ff:ff (112)ff:ff (113)ff:ff (114)ff:ff (115)ff:ff (116)ff:ff (117)ff:ff (118)ff:ff (119)ff:ff (120)ff:ff (121)ff:ff (122)ff:ff (123)ff:ff (124)ff:ff (125)ff:ff (126)ff:ff (127)ff:ff (128)ff:ff (129)ff:ff (130)ff:ff (131)ff:ff (132)ff:ff (133)ff:ff (134)ff:ff (135)ff:ff (136)ff:ff (137)ff:ff (138)ff:ff (139)ff:ff (140)ff:ff (141)ff:ff (142)ff:ff (143)ff:ff (144)ff:ff (145)ff:ff (146)ff:ff (147)ff:ff (148)ff:ff (149)ff:ff (150)ff:ff (151)ff:ff (152)ff:ff (153)ff:ff (154)ff:ff (155)ff:ff (156)ff:ff (157)ff:ff (158)ff:ff (159)ff:ff (160)ff:ff (161)ff:ff (162)ff:ff (163)ff:ff (164)ff:ff (165)ff:ff (166)ff:ff (167)ff:ff (168)ff:ff (169)ff:ff (170)ff:ff (171)ff:ff (172)ff:ff (173)ff:ff (174)ff:ff (175)ff:ff (176)ff:ff (177)ff:ff (178)ff:ff (179)ff:ff (180)ff:ff (181)ff:ff (182)ff:ff (183)ff:ff (184)ff:ff (185)ff:ff (186)ff:ff (187)ff:ff (188)ff:ff (189)ff:ff (190)ff:ff (191)ff:ff (192)ff:ff (193)ff:ff (194)ff:ff (195)ff:ff (196)ff:ff (197)ff:ff (198)ff:ff (199)ff:ff (200)ff:ff (201)ff:ff (202)ff:ff (203)ff:ff (204)ff:ff (205)ff:ff (206)ff:ff (207)ff:ff (208)ff:ff (209)ff:ff (210)ff:ff (211)ff:ff (212)ff:ff (213)ff:ff (214)ff:ff (215)ff:ff (216)ff:ff (217)ff:ff (218)ff:ff (219)ff:ff (220)ff:ff (221)ff:ff (222)ff:ff (223)ff:ff (224)ff:ff (225)ff:ff (226)ff:ff (227)ff:ff (228)ff:ff (229)ff:ff (230)ff:ff (231)ff:ff (232)ff:ff (233)ff:ff (234)ff:ff (235)ff:ff (236)ff:ff (237)ff:ff (238)ff:ff (239)ff:ff (240)ff:ff (241)ff:ff (242)ff:ff (243)ff:ff (244)ff:ff (245)ff:ff (246)ff:ff (247)ff:ff (248)ff:ff (249)ff:ff (250)ff:ff (251)ff:ff (252)ff:ff (253)ff:ff (254)ff:ff (255)ff:ff (256)ff:ff (257)ff:ff (258)ff:ff (259)ff:ff (260)ff:ff (261)ff:ff (262)ff:ff (263)ff:ff (264)ff:ff (265)ff:ff (266)ff:ff (267)ff:ff (268)ff:ff (269)ff:ff (270)ff:ff (271)ff:ff (272)ff:ff (273)ff:ff (274)ff:ff (275)ff:ff (276)ff:ff (277)ff:ff (278)ff:ff (279)ff:ff (280)ff:ff (281)ff:ff
test-framing.js:1517: exit(1) called, at Error
at __exit (test-framing.js:1517:50)
at _exit (test-framing.js:1519:7)
at _check_page (test-framing.js:5230:9)
at _test_pack (test-framing.js:5771:9)
at _main (test-framing.js:6205:9)
at Object.callMain (test-framing.js:7244:10)
at run (test-framing.js:7388:18)
at test-framing.js:7399:3
throw 'exit(' + status + ') called, at ' + new Error().stack;
^

Same test fails under SpiderMonkey.