Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

experiment: test stabilization of text and blob iterators #4562

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions test/run-drun/ok/stabilize-blob-iter.drun.ok
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
ingress Completed: Reply: 0x4449444c016c01b3c4b1f204680100010a00000000000000000101
ingress Err: IC0304: Attempt to execute a message on canister rwlgt-iiaaa-aaaaa-aaaaa-cai which contains no Wasm module
ingress Completed: Reply: 0x4449444c0000
debug.print: {stableField = "Version 0"}
ingress Completed: Reply: 0x4449444c0000
ingress Completed: Reply: 0x4449444c0000
ingress Completed: Reply: 0x4449444c0000
debug.print: {stableField = "Version 0"}
ingress Completed: Reply: 0x4449444c0000
ingress Completed: Reply: 0x4449444c0000
ingress Completed: Reply: 0x4449444c0000
debug.print: {}
ingress Completed: Reply: 0x4449444c0000
ingress Completed: Reply: 0x4449444c0000
ingress Completed: Reply: 0x4449444c0000
debug.print: {}
ingress Completed: Reply: 0x4449444c0000
ingress Completed: Reply: 0x4449444c0000
ingress Err: IC0503: Canister rwlgt-iiaaa-aaaaa-aaaaa-cai trapped explicitly: RTS error: Memory-incompatible program upgrade
19 changes: 19 additions & 0 deletions test/run-drun/ok/stabilize-text-iter.drun.ok
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
ingress Completed: Reply: 0x4449444c016c01b3c4b1f204680100010a00000000000000000101
ingress Err: IC0304: Attempt to execute a message on canister rwlgt-iiaaa-aaaaa-aaaaa-cai which contains no Wasm module
ingress Completed: Reply: 0x4449444c0000
debug.print: {stableField = "Version 0"}
ingress Completed: Reply: 0x4449444c0000
ingress Completed: Reply: 0x4449444c0000
ingress Completed: Reply: 0x4449444c0000
debug.print: {stableField = "Version 0"}
ingress Completed: Reply: 0x4449444c0000
ingress Completed: Reply: 0x4449444c0000
ingress Completed: Reply: 0x4449444c0000
debug.print: {}
ingress Completed: Reply: 0x4449444c0000
ingress Completed: Reply: 0x4449444c0000
ingress Completed: Reply: 0x4449444c0000
debug.print: {}
ingress Completed: Reply: 0x4449444c0000
ingress Completed: Reply: 0x4449444c0000
ingress Err: IC0503: Canister rwlgt-iiaaa-aaaaa-aaaaa-cai trapped explicitly: RTS error: Memory-incompatible program upgrade
15 changes: 15 additions & 0 deletions test/run-drun/stabilize-blob-iter.drun
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# SKIP ic-ref-run
ingress $ID __motoko_stabilize_before_upgrade "DIDL\x00\x00"
install $ID stabilize-blob-iter/version0.mo ""
ingress $ID print "DIDL\x00\x00"
ingress $ID __motoko_stabilize_before_upgrade "DIDL\x00\x00"
upgrade $ID stabilize-blob-iter/version0.mo ""
ingress $ID print "DIDL\x00\x00"
ingress $ID __motoko_stabilize_before_upgrade "DIDL\x00\x00"
upgrade $ID stabilize-blob-iter/version1.mo ""
ingress $ID print "DIDL\x00\x00"
ingress $ID __motoko_stabilize_before_upgrade "DIDL\x00\x00"
upgrade $ID stabilize-blob-iter/version1.mo ""
ingress $ID print "DIDL\x00\x00"
ingress $ID __motoko_stabilize_before_upgrade "DIDL\x00\x00"
upgrade $ID stabilize-blob-iter/version0.mo ""
27 changes: 27 additions & 0 deletions test/run-drun/stabilize-blob-iter/version0.mo
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import Prim "mo:prim";

actor {
let temporary = 1;

let blobiter = ("hello" : Blob).vals();

stable let value : {
stableField : Text;
} = {
stableField = "Version 0";
nonStableField = blobiter;
unreachableField = -123;
};

stable let any : Any = blobiter;
stable let tuple : (Int, Any) = (0, blobiter);
stable let variant : { #tag : Any } = #tag blobiter;
stable let record : { lab : Any } = { lab = blobiter };
stable let vector : [Any] = [blobiter];
stable let array : [var Any] = [var blobiter];
stable let opt : ?Any = ?blobiter;

public func print() : async () {
Prim.debugPrint(debug_show (value));
};
};
19 changes: 19 additions & 0 deletions test/run-drun/stabilize-blob-iter/version1.mo
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import Prim "mo:prim";

actor {
stable let value : {} = {
stableField = "Version 1";
};

stable let any : Any = null;
stable let tuple : (Int, Any) = (0, null);
stable let variant : { #tag : Any } = #tag null;
stable let record : { lab : Any } = { lab = null };
stable let vector : [Any] = [null];
stable let array : [var Any] = [var null];
stable let opt : ?Any = null;

public func print() : async () {
Prim.debugPrint(debug_show (value));
};
};
15 changes: 15 additions & 0 deletions test/run-drun/stabilize-text-iter.drun
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# SKIP ic-ref-run
ingress $ID __motoko_stabilize_before_upgrade "DIDL\x00\x00"
install $ID stabilize-text-iter/version0.mo ""
ingress $ID print "DIDL\x00\x00"
ingress $ID __motoko_stabilize_before_upgrade "DIDL\x00\x00"
upgrade $ID stabilize-text-iter/version0.mo ""
ingress $ID print "DIDL\x00\x00"
ingress $ID __motoko_stabilize_before_upgrade "DIDL\x00\x00"
upgrade $ID stabilize-text-iter/version1.mo ""
ingress $ID print "DIDL\x00\x00"
ingress $ID __motoko_stabilize_before_upgrade "DIDL\x00\x00"
upgrade $ID stabilize-text-iter/version1.mo ""
ingress $ID print "DIDL\x00\x00"
ingress $ID __motoko_stabilize_before_upgrade "DIDL\x00\x00"
upgrade $ID stabilize-text-iter/version0.mo ""
27 changes: 27 additions & 0 deletions test/run-drun/stabilize-text-iter/version0.mo
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import Prim "mo:prim";

actor {
let temporary = 1;

let textiter = "hello".chars();

stable let value : {
stableField : Text;
} = {
stableField = "Version 0";
nonStableField = textiter;
unreachableField = -123;
};

stable let any : Any = textiter;
stable let tuple : (Int, Any) = (0, textiter);
stable let variant : { #tag : Any } = #tag textiter;
stable let record : { lab : Any } = { lab = textiter };
stable let vector : [Any] = [textiter];
stable let array : [var Any] = [var textiter];
stable let opt : ?Any = ?textiter;

public func print() : async () {
Prim.debugPrint(debug_show (value));
};
};
19 changes: 19 additions & 0 deletions test/run-drun/stabilize-text-iter/version1.mo
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import Prim "mo:prim";

actor {
stable let value : {} = {
stableField = "Version 1";
};

stable let any : Any = null;
stable let tuple : (Int, Any) = (0, null);
stable let variant : { #tag : Any } = #tag null;
stable let record : { lab : Any } = { lab = null };
stable let vector : [Any] = [null];
stable let array : [var Any] = [var null];
stable let opt : ?Any = null;

public func print() : async () {
Prim.debugPrint(debug_show (value));
};
};