Skip to content

Commit

Permalink
features: add wasm annotation
Browse files Browse the repository at this point in the history
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
  • Loading branch information
giuseppe committed Jun 27, 2023
1 parent 935f4fe commit d006733
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/libcrun/container.c
Original file line number Diff line number Diff line change
Expand Up @@ -3855,7 +3855,7 @@ retrieve_mount_options (struct features_info_s **info)
}

int
libcrun_container_get_features (libcrun_context_t *context arg_unused, struct features_info_s **info, libcrun_error_t *err arg_unused)
libcrun_container_get_features (libcrun_context_t *context, struct features_info_s **info, libcrun_error_t *err arg_unused)
{
// Allocate memory for the features_info_s structure
size_t num_namspaces = sizeof (namespaces) / sizeof (namespaces[0]);
Expand Down Expand Up @@ -3920,6 +3920,9 @@ libcrun_container_get_features (libcrun_context_t *context arg_unused, struct fe
}
#endif

if (context->handler_manager && handler_by_name (context->handler_manager, "wasm"))
(*info)->annotations.run_oci_crun_wasm = true;

#if HAVE_CRIU
(*info)->annotations.run_oci_crun_checkpoint_enabled = true;
#endif
Expand Down
1 change: 1 addition & 0 deletions src/libcrun/container.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ struct annotations_info_s
bool run_oci_crun_checkpoint_enabled;
char *run_oci_crun_commit;
char *run_oci_crun_version;
bool run_oci_crun_wasm;
};

struct features_info_s
Expand Down
2 changes: 2 additions & 0 deletions src/oci_features.c
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,8 @@ crun_features_add_annotations_info (yajl_gen json_gen, const struct annotations_
add_string_to_json (json_gen, "run.oci.crun.commit", annotation->run_oci_crun_commit);
add_string_to_json (json_gen, "run.oci.crun.version", annotation->run_oci_crun_version);

add_bool_to_json (json_gen, "run.oci.crun.wasm", annotation->run_oci_crun_wasm);

yajl_gen_map_close (json_gen);
}

Expand Down
5 changes: 5 additions & 0 deletions tests/test_oci_features.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,11 @@ def test_crun_features():
sys.stderr.write("wrong value for run.oci.crun.commit\n")
return -1

if ('WASM' in get_crun_feature_string()
and annotations.get("run.oci.crun.wasm") is not True):
sys.stderr.write("wrong value for run.oci.crun.wasm\n")
return -1

if 'CRIU' in get_crun_feature_string():
if annotations.get("org.opencontainers.runc.checkpoint.enabled") is not True:
sys.stderr.write("wrong value for org.opencontainers.runc.checkpoint.enabled\n")
Expand Down

0 comments on commit d006733

Please sign in to comment.