Commits

Anonymous committed a2a5df2

Fixes issue 209.
Fix system tests on v10

  • Participants
  • Parent commits 663deb7
  • Branches v10

Comments (0)

Files changed (3)

File src/platform/posix/main.c

 # This file is part of the Python-on-a-Chip program.
 # Python-on-a-Chip is free software: you can redistribute it and/or modify
 # it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE Version 2.1.
-# 
+#
 # Python-on-a-Chip is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
     PM_RETURN_IF_ERROR(retval);
 
     retval = pm_run((uint8_t *)"main");
+
+    plat_deinit();
+
     return (int)retval;
 }

File src/tests/system/runtests.c

     retval = mod_import(pstring, &pmodB);
     PM_RETURN_IF_ERROR(retval);
 
-    /* Load builtins into thread */
-    retval = global_setBuiltins((pPmFunc_t)pmodA);
-    retval = global_setBuiltins((pPmFunc_t)pmodB);
-    PM_RETURN_IF_ERROR(retval);
-
     /* Interpret the module's bcode */
     retval = interp_addThread((pPmFunc_t)pmodA);
     retval = interp_addThread((pPmFunc_t)pmodB);
     PmReturn_t retval;
     uint16_t i;
 
+    retval = plat_init();
+    PM_RETURN_IF_ERROR(retval);
 
     /* Run the typical tests */
     for (i = 0; i < num_typical_tests; i++)
     retval = t075();
     PM_RETURN_IF_ERROR(retval);
 
+    plat_deinit();
     puts("Done.");
     return PM_RET_OK;
  }
     retval = list_new(&pobj);
     gVmGlobal.threadList = (pPmList_t)pobj;
 
+    /* Load builtins module */
+    retval = pm_loadBuiltins();
+    PM_RETURN_IF_ERROR(retval);
+
     return retval;
 }
 
     retval = mod_import(pstring, &pmod);
     PM_RETURN_IF_ERROR(retval);
 
-    /* Load builtins module */
-    retval = pm_loadBuiltins();
-    PM_RETURN_IF_ERROR(retval);
-
     /* Put builtins module in the module's attrs dict */
     retval = dict_setItem((pPmObj_t)((pPmFunc_t)pmod)->f_attrs,
                           (pPmObj_t)&pm_global_string_bi,
     PM_RETURN_IF_ERROR(retval);
     retval = interpret(INTERP_RETURN_ON_NO_THREADS);
 
-    /*
-     * De-initialize the hardware platform.
-     * Ignore plat_deinit's retval so interpret's retval returns to caller.
-     */
-    plat_deinit();
-
     return retval;
 }